/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @signatureAlgorithm = 'v2';
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('resourcedirectorymaster', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AcceptHandshakeRequest {
  handshakeId?: string(name='HandshakeId', description='The ID of the invitation.

You can call the [ListHandshakesForAccount](~~ListHandshakesForAccount~~) operation to obtain the ID.

This parameter is required.', example='h-Ih8IuPfvV0t0****'),
}

model AcceptHandshakeResponseBody = {
  handshake?: {
    createTime?: string(name='CreateTime', description='The time when the invitation was created. The time is displayed in UTC.', example='2021-01-06T02:15:40Z'),
    expireTime?: string(name='ExpireTime', description='The time when the invitation expires. The time is displayed in UTC.', example='2021-01-20T02:15:40Z'),
    handshakeId?: string(name='HandshakeId', description='The ID of the invitation.', example='h-Ih8IuPfvV0t0****'),
    masterAccountId?: string(name='MasterAccountId', description='The ID of the management account of the resource directory.', example='151266687691****'),
    masterAccountName?: string(name='MasterAccountName', description='The name of the management account of the resource directory.', example='CompanyA'),
    modifyTime?: string(name='ModifyTime', description='The time when the invitation was modified. The time is displayed in UTC.', example='2021-01-06T02:16:40Z'),
    note?: string(name='Note', description='The description of the invitation.', example='Welcome'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-3G****'),
    status?: string(name='Status', description='The status of the invitation. Valid values:

*   Pending: The invitation is waiting for confirmation.
*   Accepted: The invitation is accepted.
*   Cancelled: The invitation is canceled.
*   Declined: The invitation is rejected.
*   Expired: The invitation expires.', example='Accepted'),
    targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the invited Alibaba Cloud account.', example='177242285274****'),
    targetType?: string(name='TargetType', description='The type of the invited Alibaba Cloud account. Valid values:

*   Account: indicates the ID of the Alibaba Cloud account.
*   Email: indicates the logon email address of the Alibaba Cloud account.', example='Account'),
  }(name='Handshake', description='The information of the invitation.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='5828C836-3286-49A6-9006-15231BB19342'),
}

model AcceptHandshakeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AcceptHandshakeResponseBody(name='body'),
}

/**
 * @summary Accepts an invitation.
 *
 * @description After an invited Alibaba Cloud account joins a resource directory, it becomes a member of the resource directory. By default, the name of the invited Alibaba Cloud account is used as the display name of the account in the resource directory.
 *
 * @param request AcceptHandshakeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AcceptHandshakeResponse
 */
async function acceptHandshakeWithOptions(request: AcceptHandshakeRequest, runtime: $RuntimeOptions): AcceptHandshakeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.handshakeId)) {
    query['HandshakeId'] = request.handshakeId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AcceptHandshake',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Accepts an invitation.
 *
 * @description After an invited Alibaba Cloud account joins a resource directory, it becomes a member of the resource directory. By default, the name of the invited Alibaba Cloud account is used as the display name of the account in the resource directory.
 *
 * @param request AcceptHandshakeRequest
 * @return AcceptHandshakeResponse
 */
async function acceptHandshake(request: AcceptHandshakeRequest): AcceptHandshakeResponse {
  var runtime = new $RuntimeOptions{};
  return acceptHandshakeWithOptions(request, runtime);
}

model AddMessageContactRequest {
  emailAddress?: string(name='EmailAddress', description='The email address of the contact.

After you specify an email address, you need to call [SendEmailVerificationForMessageContact](~~SendEmailVerificationForMessageContact~~) to send verification information to the email address. After the verification is passed, the email address takes effect.

This parameter is required.', example='someone***@example.com'),
  messageTypes?: [ string ](name='MessageTypes', description='The types of messages received by the contact.

This parameter is required.'),
  name?: string(name='Name', description='The name of the contact.

The name must be unique in your resource directory.

The name must be 2 to 12 characters in length and can contain only letters.

This parameter is required.', example='tom'),
  phoneNumber?: string(name='PhoneNumber', description='The mobile phone number of the contact.

Specify the mobile phone number in the `<Country code>-<Mobile phone number>` format.

> Only mobile phone numbers in the `86-<Mobile phone number>` format in the Chinese mainland are supported.

After you specify a mobile phone number, you need to call [SendPhoneVerificationForMessageContact](~~SendPhoneVerificationForMessageContact~~) to send verification information to the mobile phone number. After the verification is passed, the mobile phone number takes effect.', example='86-139****1234'),
  title?: string(name='Title', description='The job title of the contact.

Valid values:

*   FinanceDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   TechnicalDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   MaintenanceDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   CEO

    <!-- -->

    <!-- -->

    <!-- -->

*   ProjectDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   Other

    <!-- -->

    <!-- -->

    <!-- -->

This parameter is required.', example='TechnicalDirector'),
}

model AddMessageContactResponseBody = {
  contact?: {
    contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
    createDate?: string(name='CreateDate', description='The time when the contact was created.', example='2023-03-27 17:19:21'),
  }(name='Contact', description='The information about the contact.'),
  requestId?: string(name='RequestId', description='The request ID.', example='2DFCE4C9-04A9-4C83-BB14-FE791275EC53'),
}

model AddMessageContactResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddMessageContactResponseBody(name='body'),
}

/**
 * @summary Adds a contact.
 *
 * @param request AddMessageContactRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddMessageContactResponse
 */
async function addMessageContactWithOptions(request: AddMessageContactRequest, runtime: $RuntimeOptions): AddMessageContactResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.emailAddress)) {
    query['EmailAddress'] = request.emailAddress;
  }
  if (!$isNull(request.messageTypes)) {
    query['MessageTypes'] = request.messageTypes;
  }
  if (!$isNull(request.name)) {
    query['Name'] = request.name;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.title)) {
    query['Title'] = request.title;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AddMessageContact',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Adds a contact.
 *
 * @param request AddMessageContactRequest
 * @return AddMessageContactResponse
 */
async function addMessageContact(request: AddMessageContactRequest): AddMessageContactResponse {
  var runtime = new $RuntimeOptions{};
  return addMessageContactWithOptions(request, runtime);
}

model AssociateMembersRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
  members?: [ string ](name='Members', description='The IDs of objects to which you want to bind the contact.'),
}

model AssociateMembersResponseBody = {
  members?: [ 
    {
      contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
      memberId?: string(name='MemberId', description='The ID of the object. Valid values:

- ID of the resource directory
- ID of the folder
- ID of the member', example='fd-ZDNPiT****'),
      modifyDate?: string(name='ModifyDate', description='The time when the contact was bound to the object.', example='2023-03-27 17:19:21'),
    }
  ](name='Members', description='The time when the contact was bound to the object.'),
  requestId?: string(name='RequestId', description='The request ID.', example='95060F1D-6990-4645-8920-A81D1BBFE992'),
}

model AssociateMembersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AssociateMembersResponseBody(name='body'),
}

/**
 * @summary Binds a contact to a resource directory, folder, or member.
 *
 * @param request AssociateMembersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AssociateMembersResponse
 */
async function associateMembersWithOptions(request: AssociateMembersRequest, runtime: $RuntimeOptions): AssociateMembersResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.members)) {
    query['Members'] = request.members;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AssociateMembers',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Binds a contact to a resource directory, folder, or member.
 *
 * @param request AssociateMembersRequest
 * @return AssociateMembersResponse
 */
async function associateMembers(request: AssociateMembersRequest): AssociateMembersResponse {
  var runtime = new $RuntimeOptions{};
  return associateMembersWithOptions(request, runtime);
}

model AttachControlPolicyRequest {
  policyId?: string(name='PolicyId', description='The ID of the access control policy.

This parameter is required.', example='cp-jExXAqIYkwHN****'),
  targetId?: string(name='TargetId', description='The ID of the object to which you want to attach the access control policy. Access control policies can be attached to the following objects:

*   Root folder
*   Subfolders of the Root folder
*   Members

This parameter is required.', example='fd-ZDNPiT****'),
}

model AttachControlPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='95060F1D-6990-4645-8920-A81D1BBFE992'),
}

model AttachControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AttachControlPolicyResponseBody(name='body'),
}

/**
 * @summary Attaches an access control policy.
 *
 * @description After you attach a custom access control policy, the operations performed on resources by using members are limited by the policy. Make sure that the attached policy meets your expectations. Otherwise, your business may be affected.
 * By default, the system access control policy FullAliyunAccess is attached to each folder and member.
 * The access control policy that is attached to a folder also applies to all its subfolders and all members in the subfolders.
 * A maximum of 10 access control policies can be attached to a folder or member.
 *
 * @param request AttachControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AttachControlPolicyResponse
 */
async function attachControlPolicyWithOptions(request: AttachControlPolicyRequest, runtime: $RuntimeOptions): AttachControlPolicyResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  if (!$isNull(request.targetId)) {
    query['TargetId'] = request.targetId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AttachControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Attaches an access control policy.
 *
 * @description After you attach a custom access control policy, the operations performed on resources by using members are limited by the policy. Make sure that the attached policy meets your expectations. Otherwise, your business may be affected.
 * By default, the system access control policy FullAliyunAccess is attached to each folder and member.
 * The access control policy that is attached to a folder also applies to all its subfolders and all members in the subfolders.
 * A maximum of 10 access control policies can be attached to a folder or member.
 *
 * @param request AttachControlPolicyRequest
 * @return AttachControlPolicyResponse
 */
async function attachControlPolicy(request: AttachControlPolicyRequest): AttachControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return attachControlPolicyWithOptions(request, runtime);
}

model BindSecureMobilePhoneRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='138660628348****'),
  secureMobilePhone?: string(name='SecureMobilePhone', description='The mobile phone number that you want to bind to the member for security purposes.

The mobile phone number you specify must be the same as the mobile phone number that you specify when you call the [SendVerificationCodeForBindSecureMobilePhone](~~SendVerificationCodeForBindSecureMobilePhone~~) operation to obtain a verification code.

Specify the mobile phone number in the \\\\<Country code>-\\\\<Mobile phone number> format.

> Mobile phone numbers in the `86-<Mobile phone number>` format in the Chinese mainland are not supported.

This parameter is required.', example='xx-13900001234'),
  verificationCode?: string(name='VerificationCode', description='The verification code.

You can call the [SendVerificationCodeForBindSecureMobilePhone](~~SendVerificationCodeForBindSecureMobilePhone~~) operation to obtain the verification code.

This parameter is required.', example='123456'),
}

model BindSecureMobilePhoneResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0217AFEB-5318-56D4-B167-1933D83EDF3F'),
}

model BindSecureMobilePhoneResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BindSecureMobilePhoneResponseBody(name='body'),
}

/**
 * @summary Binds a mobile phone number to a member of the resource account type in a resource directory for security purposes.
 *
 * @description You can call this API operation only to bind a mobile phone number to a member of the resource account type. You cannot call this API operation to change the mobile phone number that is bound to a member of the resource account type.
 * To ensure that the system can record the operators of management operations, you must use a RAM user or RAM role to which the AliyunResourceDirectoryFullAccess policy is attached within the management account of your resource directory to call this API operation.
 *
 * @param request BindSecureMobilePhoneRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BindSecureMobilePhoneResponse
 */
async function bindSecureMobilePhoneWithOptions(request: BindSecureMobilePhoneRequest, runtime: $RuntimeOptions): BindSecureMobilePhoneResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.secureMobilePhone)) {
    query['SecureMobilePhone'] = request.secureMobilePhone;
  }
  if (!$isNull(request.verificationCode)) {
    query['VerificationCode'] = request.verificationCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'BindSecureMobilePhone',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Binds a mobile phone number to a member of the resource account type in a resource directory for security purposes.
 *
 * @description You can call this API operation only to bind a mobile phone number to a member of the resource account type. You cannot call this API operation to change the mobile phone number that is bound to a member of the resource account type.
 * To ensure that the system can record the operators of management operations, you must use a RAM user or RAM role to which the AliyunResourceDirectoryFullAccess policy is attached within the management account of your resource directory to call this API operation.
 *
 * @param request BindSecureMobilePhoneRequest
 * @return BindSecureMobilePhoneResponse
 */
async function bindSecureMobilePhone(request: BindSecureMobilePhoneRequest): BindSecureMobilePhoneResponse {
  var runtime = new $RuntimeOptions{};
  return bindSecureMobilePhoneWithOptions(request, runtime);
}

model CancelChangeAccountEmailRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='181761095690****'),
}

model CancelChangeAccountEmailResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model CancelChangeAccountEmailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelChangeAccountEmailResponseBody(name='body'),
}

/**
 * @summary Cancels the email address change of a member.
 *
 * @param request CancelChangeAccountEmailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelChangeAccountEmailResponse
 */
async function cancelChangeAccountEmailWithOptions(request: CancelChangeAccountEmailRequest, runtime: $RuntimeOptions): CancelChangeAccountEmailResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CancelChangeAccountEmail',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Cancels the email address change of a member.
 *
 * @param request CancelChangeAccountEmailRequest
 * @return CancelChangeAccountEmailResponse
 */
async function cancelChangeAccountEmail(request: CancelChangeAccountEmailRequest): CancelChangeAccountEmailResponse {
  var runtime = new $RuntimeOptions{};
  return cancelChangeAccountEmailWithOptions(request, runtime);
}

model CancelHandshakeRequest {
  handshakeId?: string(name='HandshakeId', description='The ID of the invitation.

This parameter is required.', example='h-ycm4rp****'),
}

model CancelHandshakeResponseBody = {
  handshake?: {
    createTime?: string(name='CreateTime', description='The time when the invitation was created. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
    expireTime?: string(name='ExpireTime', description='The time when the invitation expires. The time is displayed in UTC.', example='2018-08-24T09:55:41Z'),
    handshakeId?: string(name='HandshakeId', description='The ID of the invitation.', example='h-ycm4rp****'),
    masterAccountId?: string(name='MasterAccountId', description='The ID of the management account of the resource directory.', example='172841235500****'),
    masterAccountName?: string(name='MasterAccountName', description='The name of the management account of the resource directory.', example='Alice'),
    modifyTime?: string(name='ModifyTime', description='The time when the invitation was modified. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
    note?: string(name='Note', description='The description of the invitation.', example='Welcome'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='h-ycm4rp****'),
    status?: string(name='Status', description='The status of the invitation. Valid values:

*   Pending: The invitation is waiting for confirmation.
*   Accepted: The invitation is accepted.
*   Cancelled: The invitation is canceled.
*   Declined: The invitation is rejected.
*   Expired: The invitation expires.', example='Cancelled'),
    targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the invited account.', example='someone@example.com'),
    targetType?: string(name='TargetType', description='The type of the invited account. Valid values:

*   Account: indicates the ID of the account.
*   Email: indicates the logon email address of the account.', example='Email'),
  }(name='Handshake', description='The information of the invitation.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model CancelHandshakeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelHandshakeResponseBody(name='body'),
}

/**
 * @summary Cancels an invitation.
 *
 * @param request CancelHandshakeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelHandshakeResponse
 */
async function cancelHandshakeWithOptions(request: CancelHandshakeRequest, runtime: $RuntimeOptions): CancelHandshakeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.handshakeId)) {
    query['HandshakeId'] = request.handshakeId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CancelHandshake',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Cancels an invitation.
 *
 * @param request CancelHandshakeRequest
 * @return CancelHandshakeResponse
 */
async function cancelHandshake(request: CancelHandshakeRequest): CancelHandshakeResponse {
  var runtime = new $RuntimeOptions{};
  return cancelHandshakeWithOptions(request, runtime);
}

model CancelMessageContactUpdateRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
  emailAddress?: string(name='EmailAddress', description='The email address of the contact.', example='someone***@example.com'),
  phoneNumber?: string(name='PhoneNumber', description='The mobile phone number of the contact.

Specify the mobile phone number in the `<Country code>-<Mobile phone number>` format.', example='86-139****1234'),
}

model CancelMessageContactUpdateResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model CancelMessageContactUpdateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CancelMessageContactUpdateResponseBody(name='body'),
}

/**
 * @summary Cancels the update of the mobile phone number or email address of a contact.
 *
 * @param request CancelMessageContactUpdateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CancelMessageContactUpdateResponse
 */
async function cancelMessageContactUpdateWithOptions(request: CancelMessageContactUpdateRequest, runtime: $RuntimeOptions): CancelMessageContactUpdateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.emailAddress)) {
    query['EmailAddress'] = request.emailAddress;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CancelMessageContactUpdate',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Cancels the update of the mobile phone number or email address of a contact.
 *
 * @param request CancelMessageContactUpdateRequest
 * @return CancelMessageContactUpdateResponse
 */
async function cancelMessageContactUpdate(request: CancelMessageContactUpdateRequest): CancelMessageContactUpdateResponse {
  var runtime = new $RuntimeOptions{};
  return cancelMessageContactUpdateWithOptions(request, runtime);
}

model ChangeAccountEmailRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='181761095690****'),
  email?: string(name='Email', description='The email address to be bound to the member.

> The system automatically sends a verification email to the email address. After the verification is passed, the email address takes effect, and the system changes both the logon email address and secure email address of the member.

This parameter is required.', example='someone@example.com'),
}

model ChangeAccountEmailResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model ChangeAccountEmailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChangeAccountEmailResponseBody(name='body'),
}

/**
 * @summary Changes the email address that is bound to a member.
 *
 * @param request ChangeAccountEmailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChangeAccountEmailResponse
 */
async function changeAccountEmailWithOptions(request: ChangeAccountEmailRequest, runtime: $RuntimeOptions): ChangeAccountEmailResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.email)) {
    query['Email'] = request.email;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChangeAccountEmail',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Changes the email address that is bound to a member.
 *
 * @param request ChangeAccountEmailRequest
 * @return ChangeAccountEmailResponse
 */
async function changeAccountEmail(request: ChangeAccountEmailRequest): ChangeAccountEmailResponse {
  var runtime = new $RuntimeOptions{};
  return changeAccountEmailWithOptions(request, runtime);
}

model CheckAccountDeleteRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member that you want to delete.

This parameter is required.', example='179855839641****'),
}

model CheckAccountDeleteResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='7CDDDCEF-CDFD-0825-B7D7-217BE0897B22'),
}

model CheckAccountDeleteResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckAccountDeleteResponseBody(name='body'),
}

/**
 * @summary Performs a member deletion check.
 *
 * @description Before you delete a member, you must call this API operation to check whether the member can be deleted.
 *
 * @param request CheckAccountDeleteRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckAccountDeleteResponse
 */
async function checkAccountDeleteWithOptions(request: CheckAccountDeleteRequest, runtime: $RuntimeOptions): CheckAccountDeleteResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CheckAccountDelete',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Performs a member deletion check.
 *
 * @description Before you delete a member, you must call this API operation to check whether the member can be deleted.
 *
 * @param request CheckAccountDeleteRequest
 * @return CheckAccountDeleteResponse
 */
async function checkAccountDelete(request: CheckAccountDeleteRequest): CheckAccountDeleteResponse {
  var runtime = new $RuntimeOptions{};
  return checkAccountDeleteWithOptions(request, runtime);
}

model CreateControlPolicyRequest {
  description?: string(name='Description', description='The description of the access control policy.

The description must be 1 to 1,024 characters in length. The description can contain letters, digits, underscores (_), and hyphens (-) and must start with a letter.', example='ExampleControlPolicy'),
  effectScope?: string(name='EffectScope', description='The effective scope of the access control policy.

The value RAM indicates that the access control policy takes effect only for RAM users and RAM roles.

This parameter is required.', example='RAM'),
  policyDocument?: string(name='PolicyDocument', description='The document of the access control policy.

The document can be a maximum of 4,096 characters in length.

For more information about the languages of access control policies, see [Languages of access control policies](https://help.aliyun.com/document_detail/179096.html).

For more information about the examples of access control policies, see [Examples of custom access control policies](https://help.aliyun.com/document_detail/181474.html).

This parameter is required.', example='{"Version":"1","Statement":[{"Effect":"Deny","Action":["ram:UpdateRole","ram:DeleteRole","ram:AttachPolicyToRole","ram:DetachPolicyFromRole"],"Resource":"acs:ram:*:*:role/ResourceDirectoryAccountAccessRole"}]}'),
  policyName?: string(name='PolicyName', description='The name of the access control policy.

The name must be 1 to 128 characters in length. The name can contain letters, digits, and hyphens (-) and must start with a letter.

This parameter is required.', example='ExampleControlPolicy'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='k1'),
      value?: string(name='Value', description='The tag value.', example='v1'),
    }
  ](name='Tag', description='The tag to add to the access control policy.'),
}

model CreateControlPolicyResponseBody = {
  controlPolicy?: {
    attachmentCount?: string(name='AttachmentCount', description='The number of times that the access control policy is referenced.', example='0'),
    createDate?: string(name='CreateDate', description='The time when the access control policy was created.', example='2021-03-18T09:24:19Z'),
    description?: string(name='Description', description='The description of the access control policy.', example='ExampleControlPolicy'),
    effectScope?: string(name='EffectScope', description='The effective scope of the access control policy.

The value RAM indicates that the access control policy takes effect only for RAM users and RAM roles.', example='RAM'),
    policyId?: string(name='PolicyId', description='The ID of the access control policy.', example='cp-jExXAqIYkwHN****'),
    policyName?: string(name='PolicyName', description='The name of the access control policy.', example='ExampleControlPolicy'),
    policyType?: string(name='PolicyType', description='The type of the access control policy. Valid values:

*   System: system access control policy
*   Custom: custom access control policy', example='Custom'),
    updateDate?: string(name='UpdateDate', description='The time when the access control policy was updated.', example='2021-03-18T09:24:19Z'),
  }(name='ControlPolicy', description='The details of the access control policy.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='776B05B3-A0B0-464B-A191-F4E1119A94B2'),
}

model CreateControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateControlPolicyResponseBody(name='body'),
}

/**
 * @summary Creates a custom access control policy.
 *
 * @param request CreateControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateControlPolicyResponse
 */
async function createControlPolicyWithOptions(request: CreateControlPolicyRequest, runtime: $RuntimeOptions): CreateControlPolicyResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.effectScope)) {
    query['EffectScope'] = request.effectScope;
  }
  if (!$isNull(request.policyDocument)) {
    query['PolicyDocument'] = request.policyDocument;
  }
  if (!$isNull(request.policyName)) {
    query['PolicyName'] = request.policyName;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a custom access control policy.
 *
 * @param request CreateControlPolicyRequest
 * @return CreateControlPolicyResponse
 */
async function createControlPolicy(request: CreateControlPolicyRequest): CreateControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return createControlPolicyWithOptions(request, runtime);
}

model CreateFolderRequest {
  folderName?: string(name='FolderName', description='The name of the folder.

The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.),and hyphens (-).

This parameter is required.', example='rdFolder'),
  parentFolderId?: string(name='ParentFolderId', description='The ID of the parent folder.', example='r-b1****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='k1'),
      value?: string(name='Value', description='The tag value.', example='v1'),
    }
  ](name='Tag', description='The tag to add to the folder.'),
}

model CreateFolderResponseBody = {
  folder?: {
    createTime?: string(name='CreateTime', description='The time when the folder was created.', example='2019-02-19T09:34:50.757Z'),
    folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-u8B321****'),
    folderName?: string(name='FolderName', description='The name of the folder.', example='rdFolder'),
    parentFolderId?: string(name='ParentFolderId', description='The ID of the parent folder.', example='r-b1****'),
  }(name='Folder', description='The information about the folder.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C2CBCA30-C8DD-423E-B4AD-4FB694C9180C'),
}

model CreateFolderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFolderResponseBody(name='body'),
}

/**
 * @summary Creates a folder.
 *
 * @description A maximum of five levels of folders can be created under the Root folder.
 *
 * @param request CreateFolderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFolderResponse
 */
async function createFolderWithOptions(request: CreateFolderRequest, runtime: $RuntimeOptions): CreateFolderResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.folderName)) {
    query['FolderName'] = request.folderName;
  }
  if (!$isNull(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateFolder',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a folder.
 *
 * @description A maximum of five levels of folders can be created under the Root folder.
 *
 * @param request CreateFolderRequest
 * @return CreateFolderResponse
 */
async function createFolder(request: CreateFolderRequest): CreateFolderResponse {
  var runtime = new $RuntimeOptions{};
  return createFolderWithOptions(request, runtime);
}

model CreateResourceAccountRequest {
  accountNamePrefix?: string(name='AccountNamePrefix', description='The prefix for the Alibaba Cloud account name of the member. If you leave this parameter empty, the system randomly generates a prefix.

The prefix must be 2 to 37 characters in length.

The prefix can contain letters, digits, and special characters but cannot contain consecutive special characters. The prefix must start with a letter or digit and end with a letter or digit. Valid special characters include underscores (`_`), periods (.), and hyphens (`-`).

The complete Alibaba Cloud account name of a member in a resource directory is in the @.aliyunid.com format, such as `alice@rd-3G****.aliyunid.com`.

Each name must be unique in the resource directory.', example='alice'),
  displayName?: string(name='DisplayName', description='The display name of the member.

The name must be 2 to 50 characters in length.

The name can contain letters, digits, underscores (_), periods (.), hyphens (-), and spaces.

The name must be unique in the resource directory.

This parameter is required.', example='Dev'),
  dryRun?: boolean(name='DryRun', description='Specifies whether to perform only a dry run, without performing the actual request. Valid values:

*   true: performs only a dry run. The system checks whether an identity type can be specified for the member. If the request does not pass the dry run, an error code is returned.
*   false (default): performs a dry run and performs the actual request.', example='false'),
  parentFolderId?: string(name='ParentFolderId', description='The ID of the parent folder.', example='fd-r23M55****'),
  payerAccountId?: string(name='PayerAccountId', description='The ID of the billing account. If you leave this parameter empty, the newly created member is used as its billing account.', example='12323344****'),
  resellAccountType?: string(name='ResellAccountType', description='The identity type of the member. Valid values:

*   resell: The member is an account for a reseller. This is the default value. A relationship is automatically established between the member and the reseller. The management account of the resource directory must be used as the billing account of the member.
*   non_resell: The member is not an account for a reseller. The member is an account that is not associated with a reseller. You can directly use the account to purchase Alibaba Cloud resources. The member is used as its own billing account.

> This parameter is available only for resellers at the international site (alibabacloud.com).', example='resell'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='k1'),
      value?: string(name='Value', description='The value of the tag.', example='v1'),
    }
  ](name='Tag', description='The tag of the member.'),
}

model CreateResourceAccountResponseBody = {
  account?: {
    accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='112730938585****'),
    accountName?: string(name='AccountName', description='The Alibaba Cloud account name of the member.', example='alice@rd-3g****.aliyunid.com'),
    displayName?: string(name='DisplayName', description='The display name of the member.', example='Dev'),
    folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-r23M55****'),
    joinMethod?: string(name='JoinMethod', description='The way in which the member joins the resource directory. Valid values:

*   invited: The member is invited to join the resource directory.
*   created: The member is directly created in the resource directory.', example='created'),
    joinTime?: string(name='JoinTime', description='The time when the member joined the resource directory. The time is displayed in UTC.', example='2020-12-31T03:37:39.456Z'),
    modifyTime?: string(name='ModifyTime', description='The time when the member was modified. The time is displayed in UTC.', example='2020-12-31T03:37:39.456Z'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-3G****'),
    status?: string(name='Status', description='The status of the member. The value CreateSuccess indicates that the member is created.', example='CreateSuccess'),
    type?: string(name='Type', description='The type of the member. The value ResourceAccount indicates that the member is a resource account.', example='ResourceAccount'),
  }(name='Account', description='The information of the member.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B356A415-D860-43E5-865A-E2193D62BBD6'),
}

model CreateResourceAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateResourceAccountResponseBody(name='body'),
}

/**
 * @summary Creates a member of the resource account type.
 *
 * @description A member serves as a container for resources and is also an organizational unit in a resource directory. A member indicates a project or application. The resources of different members are isolated.
 * This topic provides an example on how to call the API operation to create a member in the `fd-r23M55****` folder. The display name of the member is `Dev`, and the prefix for the Alibaba Cloud account name of the member is `alice`.
 *
 * @param request CreateResourceAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateResourceAccountResponse
 */
async function createResourceAccountWithOptions(request: CreateResourceAccountRequest, runtime: $RuntimeOptions): CreateResourceAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountNamePrefix)) {
    query['AccountNamePrefix'] = request.accountNamePrefix;
  }
  if (!$isNull(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!$isNull(request.dryRun)) {
    query['DryRun'] = request.dryRun;
  }
  if (!$isNull(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!$isNull(request.payerAccountId)) {
    query['PayerAccountId'] = request.payerAccountId;
  }
  if (!$isNull(request.resellAccountType)) {
    query['ResellAccountType'] = request.resellAccountType;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateResourceAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a member of the resource account type.
 *
 * @description A member serves as a container for resources and is also an organizational unit in a resource directory. A member indicates a project or application. The resources of different members are isolated.
 * This topic provides an example on how to call the API operation to create a member in the `fd-r23M55****` folder. The display name of the member is `Dev`, and the prefix for the Alibaba Cloud account name of the member is `alice`.
 *
 * @param request CreateResourceAccountRequest
 * @return CreateResourceAccountResponse
 */
async function createResourceAccount(request: CreateResourceAccountRequest): CreateResourceAccountResponse {
  var runtime = new $RuntimeOptions{};
  return createResourceAccountWithOptions(request, runtime);
}

model DeclineHandshakeRequest {
  handshakeId?: string(name='HandshakeId', description='The ID of the invitation.

This parameter is required.', example='h-ycm4rp****'),
}

model DeclineHandshakeResponseBody = {
  handshake?: {
    createTime?: string(name='CreateTime', description='The time when the invitation was created.', example='2018-08-10T09:55:41Z'),
    expireTime?: string(name='ExpireTime', description='The time when the invitation expires.', example='2018-08-10T09:55:41Z'),
    handshakeId?: string(name='HandshakeId', description='The ID of the invitation.', example='h-ycm4rp****'),
    masterAccountId?: string(name='MasterAccountId', description='The ID of the management account of the resource directory.', example='172841235500****'),
    masterAccountName?: string(name='MasterAccountName', description='The name of the management account of the resource directory.', example='Alice'),
    modifyTime?: string(name='ModifyTime', description='The time when the invitation was modified.', example='2018-08-10T09:55:41Z'),
    note?: string(name='Note', description='The description of the invitation.', example='Welcome'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-abcdef****'),
    status?: string(name='Status', description='The status of the invitation. Valid values:

*   Pending: The invitation is waiting for confirmation.
*   Accepted: The invitation is accepted.
*   Cancelled: The invitation is canceled.
*   Declined: The invitation is rejected.
*   Expired: The invitation expires.', example='Declined'),
    targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the invited account.', example='someone@example.com'),
    targetType?: string(name='TargetType', description='The type of the invited account. Valid values:

*   Account: indicates the ID of the account.
*   Email: indicates the logon email address of the account.', example='Email'),
  }(name='Handshake', description='The information of the invitation.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model DeclineHandshakeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeclineHandshakeResponseBody(name='body'),
}

/**
 * @summary Rejects an invitation.
 *
 * @param request DeclineHandshakeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeclineHandshakeResponse
 */
async function declineHandshakeWithOptions(request: DeclineHandshakeRequest, runtime: $RuntimeOptions): DeclineHandshakeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.handshakeId)) {
    query['HandshakeId'] = request.handshakeId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeclineHandshake',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Rejects an invitation.
 *
 * @param request DeclineHandshakeRequest
 * @return DeclineHandshakeResponse
 */
async function declineHandshake(request: DeclineHandshakeRequest): DeclineHandshakeResponse {
  var runtime = new $RuntimeOptions{};
  return declineHandshakeWithOptions(request, runtime);
}

model DeleteAccountRequest {
  abandonableCheckId?: [ string ](name='AbandonableCheckId', description='The IDs of the check items that you can choose to ignore for the member deletion.

You can obtain the IDs from the response of the [GetAccountDeletionCheckResult](~~GetAccountDeletionCheckResult~~) operation.'),
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member that you want to delete.

This parameter is required.', example='169946124551****'),
}

model DeleteAccountShrinkRequest {
  abandonableCheckIdShrink?: string(name='AbandonableCheckId', description='The IDs of the check items that you can choose to ignore for the member deletion.

You can obtain the IDs from the response of the [GetAccountDeletionCheckResult](~~GetAccountDeletionCheckResult~~) operation.'),
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member that you want to delete.

This parameter is required.', example='169946124551****'),
}

model DeleteAccountResponseBody = {
  deletionType?: string(name='DeletionType', description='The type of the deletion. Valid values:

*   0: direct deletion. If the member does not have pay-as-you-go resources that are purchased within the previous 30 days, the system directly deletes the member.
*   1: deletion with a silence period. If the member has pay-as-you-go resources that are purchased within the previous 30 days, the member enters a silence period. The system starts to delete the member until the silence period ends. For more information about the silence period, see [What is the silence period for member deletion?](https://help.aliyun.com/document_detail/446079.html)', example='0'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='009429F8-C1C0-5872-B674-A6C2333B9647'),
}

model DeleteAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAccountResponseBody(name='body'),
}

/**
 * @summary Deletes a member of the resource account type.
 *
 * @description Before you delete a member, we recommend that you call the [CheckAccountDelete](~~CheckAccountDelete~~) and [GetAccountDeletionCheckResult](~~GetAccountDeletionCheckResult~~) operations to check whether the member meets deletion requirements. You can call the DeleteAccount operation to delete only members that meet the deletion requirements.
 * After you submit a deletion request for a member, you can call the [GetAccountDeletionStatus](~~GetAccountDeletionStatus~~) operation to query the deletion status of the member. After a member is deleted, the resources and data within the member are deleted, and you can no longer use the member to log on to the Alibaba Cloud Management Console. In addition, the member cannot be recovered. Proceed with caution. For more information about how to delete a member, see [Delete a member of the resource account type](https://help.aliyun.com/document_detail/446078.html).
 *
 * @param tmpReq DeleteAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAccountResponse
 */
async function deleteAccountWithOptions(tmpReq: DeleteAccountRequest, runtime: $RuntimeOptions): DeleteAccountResponse {
  tmpReq.validate();
  var request = new DeleteAccountShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.abandonableCheckId)) {
    request.abandonableCheckIdShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.abandonableCheckId, 'AbandonableCheckId', 'json');
  }
  var query = {};
  if (!$isNull(request.abandonableCheckIdShrink)) {
    query['AbandonableCheckId'] = request.abandonableCheckIdShrink;
  }
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a member of the resource account type.
 *
 * @description Before you delete a member, we recommend that you call the [CheckAccountDelete](~~CheckAccountDelete~~) and [GetAccountDeletionCheckResult](~~GetAccountDeletionCheckResult~~) operations to check whether the member meets deletion requirements. You can call the DeleteAccount operation to delete only members that meet the deletion requirements.
 * After you submit a deletion request for a member, you can call the [GetAccountDeletionStatus](~~GetAccountDeletionStatus~~) operation to query the deletion status of the member. After a member is deleted, the resources and data within the member are deleted, and you can no longer use the member to log on to the Alibaba Cloud Management Console. In addition, the member cannot be recovered. Proceed with caution. For more information about how to delete a member, see [Delete a member of the resource account type](https://help.aliyun.com/document_detail/446078.html).
 *
 * @param request DeleteAccountRequest
 * @return DeleteAccountResponse
 */
async function deleteAccount(request: DeleteAccountRequest): DeleteAccountResponse {
  var runtime = new $RuntimeOptions{};
  return deleteAccountWithOptions(request, runtime);
}

model DeleteControlPolicyRequest {
  policyId?: string(name='PolicyId', description='The ID of the access control policy.

This parameter is required.', example='cp-SImPt8GCEwiq****'),
}

model DeleteControlPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='C8541E06-B207-46BF-92C9-DC8DE4609D75'),
}

model DeleteControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteControlPolicyResponseBody(name='body'),
}

/**
 * @summary Deletes a custom access control policy.
 *
 * @description If you want to delete a custom access control policy that is attached to folders or members, you must call the [DetachControlPolicy](~~DetachControlPolicy~~) operation to detach the policy before you delete it.
 *
 * @param request DeleteControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteControlPolicyResponse
 */
async function deleteControlPolicyWithOptions(request: DeleteControlPolicyRequest, runtime: $RuntimeOptions): DeleteControlPolicyResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a custom access control policy.
 *
 * @description If you want to delete a custom access control policy that is attached to folders or members, you must call the [DetachControlPolicy](~~DetachControlPolicy~~) operation to detach the policy before you delete it.
 *
 * @param request DeleteControlPolicyRequest
 * @return DeleteControlPolicyResponse
 */
async function deleteControlPolicy(request: DeleteControlPolicyRequest): DeleteControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return deleteControlPolicyWithOptions(request, runtime);
}

model DeleteFolderRequest {
  folderId?: string(name='FolderId', description='The ID of the folder.

This parameter is required.', example='fd-ae1in7****'),
}

model DeleteFolderResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model DeleteFolderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFolderResponseBody(name='body'),
}

/**
 * @summary Deletes a folder.
 *
 * @description Before you delete a folder, you must make sure that the folder does not contain members or subfolders.
 *
 * @param request DeleteFolderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFolderResponse
 */
async function deleteFolderWithOptions(request: DeleteFolderRequest, runtime: $RuntimeOptions): DeleteFolderResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.folderId)) {
    query['FolderId'] = request.folderId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteFolder',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a folder.
 *
 * @description Before you delete a folder, you must make sure that the folder does not contain members or subfolders.
 *
 * @param request DeleteFolderRequest
 * @return DeleteFolderResponse
 */
async function deleteFolder(request: DeleteFolderRequest): DeleteFolderResponse {
  var runtime = new $RuntimeOptions{};
  return deleteFolderWithOptions(request, runtime);
}

model DeleteMessageContactRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.

This parameter is required.', example='c-qL4HqKONzOM7****'),
  retainContactInMembers?: boolean(name='RetainContactInMembers', description='Specifies whether to retain the contact for members. Valid values:

*   true (default): retains the contact for members. In this case, the contact can still receive messages for the members.
*   false: does not retain the contact for members. In this case, the contact can no longer receive messages for the members. If you set this parameter to false, the response is asynchronously returned. You can call [GetMessageContactDeletionStatus](~~GetMessageContactDeletionStatus~~) to obtain the deletion result.', example='true'),
}

model DeleteMessageContactResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
  status?: string(name='Status', description='The deletion status of the contact. Valid values:

*   Deleting
*   Deleted', example='Deleting'),
}

model DeleteMessageContactResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteMessageContactResponseBody(name='body'),
}

/**
 * @summary Deletes a contact.
 *
 * @param request DeleteMessageContactRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteMessageContactResponse
 */
async function deleteMessageContactWithOptions(request: DeleteMessageContactRequest, runtime: $RuntimeOptions): DeleteMessageContactResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.retainContactInMembers)) {
    query['RetainContactInMembers'] = request.retainContactInMembers;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteMessageContact',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a contact.
 *
 * @param request DeleteMessageContactRequest
 * @return DeleteMessageContactResponse
 */
async function deleteMessageContact(request: DeleteMessageContactRequest): DeleteMessageContactResponse {
  var runtime = new $RuntimeOptions{};
  return deleteMessageContactWithOptions(request, runtime);
}

model DeregisterDelegatedAdministratorRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member in the resource directory.

This parameter is required.', example='181761095690****'),
  servicePrincipal?: string(name='ServicePrincipal', description='The identifier of the trusted service.

This parameter is required.', example='cloudfw.aliyuncs.com'),
}

model DeregisterDelegatedAdministratorResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='DF5D5C52-7BD0-40E7-94C6-23A1505038A2'),
}

model DeregisterDelegatedAdministratorResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeregisterDelegatedAdministratorResponseBody(name='body'),
}

/**
 * @summary Removes a delegated administrator account for a trusted service.
 *
 * @description If the delegated administrator account that you want to remove has historical management tasks in the related trusted service, the trusted service may be affected after the delegated administrator account is removed. Therefore, proceed with caution.
 *
 * @param request DeregisterDelegatedAdministratorRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeregisterDelegatedAdministratorResponse
 */
async function deregisterDelegatedAdministratorWithOptions(request: DeregisterDelegatedAdministratorRequest, runtime: $RuntimeOptions): DeregisterDelegatedAdministratorResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.servicePrincipal)) {
    query['ServicePrincipal'] = request.servicePrincipal;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeregisterDelegatedAdministrator',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Removes a delegated administrator account for a trusted service.
 *
 * @description If the delegated administrator account that you want to remove has historical management tasks in the related trusted service, the trusted service may be affected after the delegated administrator account is removed. Therefore, proceed with caution.
 *
 * @param request DeregisterDelegatedAdministratorRequest
 * @return DeregisterDelegatedAdministratorResponse
 */
async function deregisterDelegatedAdministrator(request: DeregisterDelegatedAdministratorRequest): DeregisterDelegatedAdministratorResponse {
  var runtime = new $RuntimeOptions{};
  return deregisterDelegatedAdministratorWithOptions(request, runtime);
}

model DestroyResourceDirectoryResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model DestroyResourceDirectoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DestroyResourceDirectoryResponseBody(name='body'),
}

/**
 * @summary Disables a resource directory. This operation cannot be undone. Therefore, proceed with caution.
 *
 * @description Before you disable a resource directory, you must make sure that the following requirements are met:
 * *   All members of the cloud account type in the resource directory are removed. You can call the [RemoveCloudAccount](~~RemoveCloudAccount~~) operation to remove a member of the cloud account type.
 * *   All folders except the Root folder are deleted from the resource directory. You can call the [DeleteFolder](~~DeleteFolder~~) operation to delete a folder.
 *
 * @param request DestroyResourceDirectoryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DestroyResourceDirectoryResponse
 */
async function destroyResourceDirectoryWithOptions(runtime: $RuntimeOptions): DestroyResourceDirectoryResponse {
  var req = new OpenApiUtil.OpenApiRequest{};
  var params = new OpenApiUtil.Params{
    action = 'DestroyResourceDirectory',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Disables a resource directory. This operation cannot be undone. Therefore, proceed with caution.
 *
 * @description Before you disable a resource directory, you must make sure that the following requirements are met:
 * *   All members of the cloud account type in the resource directory are removed. You can call the [RemoveCloudAccount](~~RemoveCloudAccount~~) operation to remove a member of the cloud account type.
 * *   All folders except the Root folder are deleted from the resource directory. You can call the [DeleteFolder](~~DeleteFolder~~) operation to delete a folder.
 *
 * @return DestroyResourceDirectoryResponse
 */
async function destroyResourceDirectory(): DestroyResourceDirectoryResponse {
  var runtime = new $RuntimeOptions{};
  return destroyResourceDirectoryWithOptions(runtime);
}

model DetachControlPolicyRequest {
  policyId?: string(name='PolicyId', description='The ID of the access control policy.

This parameter is required.', example='cp-jExXAqIYkwHN****'),
  targetId?: string(name='TargetId', description='The ID of the object from which you want to detach the access control policy. Access control policies can be attached to the following objects:

*   Root folder
*   Subfolders of the Root folder
*   Members

This parameter is required.', example='fd-ZDNPiT****'),
}

model DetachControlPolicyResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9EA4F962-1A2E-4AFE-BE0C-B14736FC46CC'),
}

model DetachControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetachControlPolicyResponseBody(name='body'),
}

/**
 * @summary Detaches an access control policy.
 *
 * @description After you detach an access control policy, the operations performed on resources by using members are not limited by the policy. Make sure that the detached policy meets your expectations. Otherwise, your business may be affected.
 * Both the system and custom access control policies can be detached. If an object has only one access control policy attached, the policy cannot be detached.
 *
 * @param request DetachControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetachControlPolicyResponse
 */
async function detachControlPolicyWithOptions(request: DetachControlPolicyRequest, runtime: $RuntimeOptions): DetachControlPolicyResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  if (!$isNull(request.targetId)) {
    query['TargetId'] = request.targetId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DetachControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Detaches an access control policy.
 *
 * @description After you detach an access control policy, the operations performed on resources by using members are not limited by the policy. Make sure that the detached policy meets your expectations. Otherwise, your business may be affected.
 * Both the system and custom access control policies can be detached. If an object has only one access control policy attached, the policy cannot be detached.
 *
 * @param request DetachControlPolicyRequest
 * @return DetachControlPolicyResponse
 */
async function detachControlPolicy(request: DetachControlPolicyRequest): DetachControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return detachControlPolicyWithOptions(request, runtime);
}

model DisableControlPolicyResponseBody = {
  enablementStatus?: string(name='EnablementStatus', description='The status of the Control Policy feature. Valid values:

*   Enabled: The feature is enabled.
*   PendingEnable: The feature is being enabled.
*   Disabled: The feature is disabled.
*   PendingDisable: The feature is being disabled.', example='PendingDisable'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='7C709979-451D-4C92-835D-7DDCCAA562E9'),
}

model DisableControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisableControlPolicyResponseBody(name='body'),
}

/**
 * @summary Disables the Control Policy feature.
 *
 * @description After you disable the Control Policy feature, the system automatically detaches all access control policies that are attached to folders and members. The system does not delete these access control policies, but you cannot attach them to folders or members again.
 * > If you disable the Control Policy feature, the permissions of all folders and members in your resource directory are affected. Therefore, proceed with caution.
 *
 * @param request DisableControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisableControlPolicyResponse
 */
async function disableControlPolicyWithOptions(runtime: $RuntimeOptions): DisableControlPolicyResponse {
  var req = new OpenApiUtil.OpenApiRequest{};
  var params = new OpenApiUtil.Params{
    action = 'DisableControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Disables the Control Policy feature.
 *
 * @description After you disable the Control Policy feature, the system automatically detaches all access control policies that are attached to folders and members. The system does not delete these access control policies, but you cannot attach them to folders or members again.
 * > If you disable the Control Policy feature, the permissions of all folders and members in your resource directory are affected. Therefore, proceed with caution.
 *
 * @return DisableControlPolicyResponse
 */
async function disableControlPolicy(): DisableControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return disableControlPolicyWithOptions(runtime);
}

model DisassociateMembersRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.

This parameter is required.', example='c-qL4HqKONzOM7****'),
  members?: [ string ](name='Members', description='The IDs of objects from which you want to unbind the contact.

This parameter is required.'),
}

model DisassociateMembersResponseBody = {
  members?: [ 
    {
      contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
      memberId?: string(name='MemberId', description='The ID of the object. Valid values:

- ID of the resource directory
- ID of the folder
- ID of the member', example='fd-ZDNPiT****'),
      modifyDate?: string(name='ModifyDate', description='The time when the contact was unbound from the object.', example='2023-03-27 17:19:21'),
    }
  ](name='Members', description='The time when the contact was unbound from the object.'),
  requestId?: string(name='RequestId', description='The request ID.', example='95060F1D-6990-4645-8920-A81D1BBFE992'),
}

model DisassociateMembersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisassociateMembersResponseBody(name='body'),
}

/**
 * @summary Unbinds a contact from a resource directory, folder, or member.
 *
 * @param request DisassociateMembersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisassociateMembersResponse
 */
async function disassociateMembersWithOptions(request: DisassociateMembersRequest, runtime: $RuntimeOptions): DisassociateMembersResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.members)) {
    query['Members'] = request.members;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DisassociateMembers',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Unbinds a contact from a resource directory, folder, or member.
 *
 * @param request DisassociateMembersRequest
 * @return DisassociateMembersResponse
 */
async function disassociateMembers(request: DisassociateMembersRequest): DisassociateMembersResponse {
  var runtime = new $RuntimeOptions{};
  return disassociateMembersWithOptions(request, runtime);
}

model EnableControlPolicyResponseBody = {
  enablementStatus?: string(name='EnablementStatus', description='The status of the Control Policy feature. Valid values:

*   Enabled: The feature is enabled.
*   PendingEnable: The feature is being enabled.
*   Disabled: The feature is disabled.
*   PendingDisable: The feature is being disabled.', example='PendingEnable'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='8CE7BD95-EFFA-4911-A1E0-BD4412697FEB'),
}

model EnableControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableControlPolicyResponseBody(name='body'),
}

/**
 * @summary Enables the Control Policy feature.
 *
 * @description The Control Policy feature provided by the Resource Directory service allows you to manage the permission boundaries of the folders or members in your resource directory in a centralized manner. This feature is implemented based on the resource directory. You can use this feature to develop common or dedicated rules for access control. The Control Policy feature does not grant permissions but only defines permission boundaries. A member in a resource directory can be used to access resources only after it is granted the required permissions by using the Resource Access Management (RAM) service. For more information, see [Overview of the Control Policy feature](https://help.aliyun.com/document_detail/178671.html).
 *
 * @param request EnableControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableControlPolicyResponse
 */
async function enableControlPolicyWithOptions(runtime: $RuntimeOptions): EnableControlPolicyResponse {
  var req = new OpenApiUtil.OpenApiRequest{};
  var params = new OpenApiUtil.Params{
    action = 'EnableControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enables the Control Policy feature.
 *
 * @description The Control Policy feature provided by the Resource Directory service allows you to manage the permission boundaries of the folders or members in your resource directory in a centralized manner. This feature is implemented based on the resource directory. You can use this feature to develop common or dedicated rules for access control. The Control Policy feature does not grant permissions but only defines permission boundaries. A member in a resource directory can be used to access resources only after it is granted the required permissions by using the Resource Access Management (RAM) service. For more information, see [Overview of the Control Policy feature](https://help.aliyun.com/document_detail/178671.html).
 *
 * @return EnableControlPolicyResponse
 */
async function enableControlPolicy(): EnableControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return enableControlPolicyWithOptions(runtime);
}

model EnableResourceDirectoryRequest {
  dryRun?: boolean(name='DryRun', description='Specifies whether to perform only a dry run, without performing the actual request. Valid values:

*   **true**: performs only a dry run.
*   **false** (default): performs a dry run and performs the actual request.', example='false'),
  enableMode?: string(name='EnableMode', description='The mode in which you enable a resource directory. Valid values:

*   CurrentAccount: The current account is used to enable a resource directory.
*   NewManagementAccount: A newly created account is used to enable a resource directory. If you select this mode, you must configure the `MAName`, `MASecureMobilePhone`, and `VerificationCode` parameters.

This parameter is required.', example='CurrentAccount'),
  MAName?: string(name='MAName', description='The name of the newly created account.

Specify the name in the `<Prefix>@rdadmin.aliyunid.com` format. The prefix can contain letters, digits, and special characters but cannot contain consecutive special characters. The prefix must start and end with a letter or digit. Valid special characters include underscores (`_`), periods (.), and hyphens (-). The prefix must be 2 to 50 characters in length.', example='user01@rdadmin.aliyunid.com'),
  MASecureMobilePhone?: string(name='MASecureMobilePhone', description='The mobile phone number that is bound to the newly created account.

If you leave this parameter empty, the mobile phone number that is bound to the current account is used. The mobile phone number you specify must be the same as the mobile phone number that you specify when you call the [SendVerificationCodeForEnableRD](~~SendVerificationCodeForEnableRD~~) operation to obtain a verification code.

Specify the mobile phone number in the `<Country code>-<Mobile phone number>` format.

> Mobile phone numbers in the `86-<Mobile phone number>` format in the Chinese mainland are not supported.', example='xx-13900001234'),
  verificationCode?: string(name='VerificationCode', description='The verification code.

You can call the [SendVerificationCodeForEnableRD](~~SendVerificationCodeForEnableRD~~) operation to obtain the verification code.', example='123456'),
}

model EnableResourceDirectoryResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='EC2FE94D-A4A2-51A1-A493-5C273A36C46A'),
  resourceDirectory?: {
    createTime?: string(name='CreateTime', description='The time when the resource directory was enabled.', example='2021-12-08T02:15:31.744Z'),
    masterAccountId?: string(name='MasterAccountId', description='The ID of the management account.', example='507408460615****'),
    masterAccountName?: string(name='MasterAccountName', description='The name of the management account.', example='alice@example.com'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-54****'),
    rootFolderId?: string(name='RootFolderId', description='The ID of the Root folder.', example='r-G9****'),
  }(name='ResourceDirectory', description='The information about the resource directory.'),
}

model EnableResourceDirectoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableResourceDirectoryResponseBody(name='body'),
}

/**
 * @summary Enables a resource directory.
 *
 * @description You can use the current account or a newly created account to enable a resource directory. For more information, see [Enable a resource directory](https://help.aliyun.com/document_detail/111215.html).
 *
 * @param request EnableResourceDirectoryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableResourceDirectoryResponse
 */
async function enableResourceDirectoryWithOptions(request: EnableResourceDirectoryRequest, runtime: $RuntimeOptions): EnableResourceDirectoryResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.dryRun)) {
    query['DryRun'] = request.dryRun;
  }
  if (!$isNull(request.enableMode)) {
    query['EnableMode'] = request.enableMode;
  }
  if (!$isNull(request.MAName)) {
    query['MAName'] = request.MAName;
  }
  if (!$isNull(request.MASecureMobilePhone)) {
    query['MASecureMobilePhone'] = request.MASecureMobilePhone;
  }
  if (!$isNull(request.verificationCode)) {
    query['VerificationCode'] = request.verificationCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'EnableResourceDirectory',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enables a resource directory.
 *
 * @description You can use the current account or a newly created account to enable a resource directory. For more information, see [Enable a resource directory](https://help.aliyun.com/document_detail/111215.html).
 *
 * @param request EnableResourceDirectoryRequest
 * @return EnableResourceDirectoryResponse
 */
async function enableResourceDirectory(request: EnableResourceDirectoryRequest): EnableResourceDirectoryResponse {
  var runtime = new $RuntimeOptions{};
  return enableResourceDirectoryWithOptions(request, runtime);
}

model GetAccountRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='181761095690****'),
  includeTags?: boolean(name='IncludeTags', description='Specifies whether to return the information of tags. Valid values:

*   false (default value)
*   true', example='true'),
}

model GetAccountResponseBody = {
  account?: {
    accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='181761095690****'),
    accountName?: string(name='AccountName', description='The Alibaba Cloud account name of the member.', example='someone@example.com'),
    displayName?: string(name='DisplayName', description='The display name of the member.', example='admin'),
    emailStatus?: string(name='EmailStatus', description='The status of the modification for the email address bound to the member. Valid values:

*   If the value of this parameter is empty, no modification is performed for the email address.
*   WAIT_MODIFY: The modification is being performed.
*   CANCELLED: The modification is canceled.
*   EXPIRED: The modification expires.', example='WAIT_MODIFY'),
    folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-bVaRIG****'),
    hasSecureMobilePhone?: boolean(name='HasSecureMobilePhone', description='Indicates whether a mobile phone number is bound to the member for security purposes. Valid values:

*   true
*   false', example='true'),
    identityInformation?: string(name='IdentityInformation', description='The real-name verification information.', example='aliyun-admin'),
    joinMethod?: string(name='JoinMethod', description='The way in which the member joins the resource directory. Valid values:

*   invited: The member is invited to join the resource directory.
*   created: The member is directly created in the resource directory.', example='created'),
    joinTime?: string(name='JoinTime', description='The time when the member joined the resource directory.', example='2015-01-23T12:33:18Z'),
    location?: string(name='Location', description='The location of the member in the resource directory.'),
    modifyTime?: string(name='ModifyTime', description='The time when the member was modified.', example='2015-01-23T12:33:18Z'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-k3****'),
    resourceDirectoryPath?: string(name='ResourceDirectoryPath', description='The path of the member in the resource directory.'),
    status?: string(name='Status', description='The status of the member. Valid values:

*   CreateSuccess: The member is created.
*   PromoteVerifying: The upgrade of the member is being confirmed.
*   PromoteFailed: The upgrade of the member fails.
*   PromoteExpired: The upgrade of the member expires.
*   PromoteCancelled: The upgrade of the member is canceled.
*   PromoteSuccess: The member is upgraded.
*   InviteSuccess: The member accepts the invitation.', example='CreateSuccess'),
    tags?: [ 
      {
        key?: string(name='Key', description='The tag key.', example='tag_key'),
        value?: string(name='Value', description='The tag value.', example='tag_value'),
      }
    ](name='Tags', description='The tags of the member.'),
    type?: string(name='Type', description='The type of the member. Valid values:

*   CloudAccount: cloud account
*   ResourceAccount: resource account', example='ResourceAccount'),
  }(name='Account', description='The information about the member.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model GetAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAccountResponseBody(name='body'),
}

/**
 * @summary Queries the information of a member.
 *
 * @param request GetAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAccountResponse
 */
async function getAccountWithOptions(request: GetAccountRequest, runtime: $RuntimeOptions): GetAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.includeTags)) {
    query['IncludeTags'] = request.includeTags;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information of a member.
 *
 * @param request GetAccountRequest
 * @return GetAccountResponse
 */
async function getAccount(request: GetAccountRequest): GetAccountResponse {
  var runtime = new $RuntimeOptions{};
  return getAccountWithOptions(request, runtime);
}

model GetAccountDeletionCheckResultRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member that you want to delete.

This parameter is required.', example='179855839641****'),
}

model GetAccountDeletionCheckResultResponseBody = {
  accountDeletionCheckResultInfo?: {
    abandonableChecks?: [ 
      {
        checkId?: string(name='CheckId', description='The ID of the check item.', example='NON_SP_cs'),
        checkName?: string(name='CheckName', description='The name of the cloud service to which the check item belongs.', example='Container Service for Kubernetes'),
        description?: string(name='Description', description='The description of the check item.', example='An instance of a cloud service is running within the member. Submit a ticket to contact Alibaba Cloud technical support.'),
      }
    ](name='AbandonableChecks', description='The check items that you can choose to ignore for the member deletion.

> This parameter may be returned if the value of AllowDelete is true.'),
    allowDelete?: string(name='AllowDelete', description='Indicates whether the member can be deleted. Valid values:

*   true: The member can be deleted.
*   false: The member cannot be deleted.', example='false'),
    notAllowReason?: [ 
      {
        checkId?: string(name='CheckId', description='The ID of the check item.', example='NON_SP_efc'),
        checkName?: string(name='CheckName', description='The name of the cloud service to which the check item belongs.', example='Enterprise finance'),
        description?: string(name='Description', description='The description of the check item.', example='This account is an Enterprise Finance associated account. Please remove the financial association of this account before deleting it.'),
      }
    ](name='NotAllowReason', description='The reasons why the member cannot be deleted.

> This parameter is returned only if the value of AllowDelete is false.'),
    status?: string(name='Status', description='The status of the check. Valid values:

*   PreCheckComplete: The check is complete.
*   PreChecking: The check is in progress.', example='PreCheckComplete'),
  }(name='AccountDeletionCheckResultInfo', description='The result of the deletion check for the member.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='54AC391D-4F7F-5F08-B8D3-0AECDE6EC5BD'),
}

model GetAccountDeletionCheckResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAccountDeletionCheckResultResponseBody(name='body'),
}

/**
 * @summary Queries the result of a member deletion check.
 *
 * @description After you call the [CheckAccountDelete](~~CheckAccountDelete~~) operation to perform a member deletion check, you can call the [GetAccountDeletionCheckResult](~~GetAccountDeletionCheckResult~~) operation to query the check result. If the check result shows that the member meets deletion requirements, you can delete the member. Otherwise, you need to first modify the items that do not meet requirements.
 *
 * @param request GetAccountDeletionCheckResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAccountDeletionCheckResultResponse
 */
async function getAccountDeletionCheckResultWithOptions(request: GetAccountDeletionCheckResultRequest, runtime: $RuntimeOptions): GetAccountDeletionCheckResultResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAccountDeletionCheckResult',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the result of a member deletion check.
 *
 * @description After you call the [CheckAccountDelete](~~CheckAccountDelete~~) operation to perform a member deletion check, you can call the [GetAccountDeletionCheckResult](~~GetAccountDeletionCheckResult~~) operation to query the check result. If the check result shows that the member meets deletion requirements, you can delete the member. Otherwise, you need to first modify the items that do not meet requirements.
 *
 * @param request GetAccountDeletionCheckResultRequest
 * @return GetAccountDeletionCheckResultResponse
 */
async function getAccountDeletionCheckResult(request: GetAccountDeletionCheckResultRequest): GetAccountDeletionCheckResultResponse {
  var runtime = new $RuntimeOptions{};
  return getAccountDeletionCheckResultWithOptions(request, runtime);
}

model GetAccountDeletionStatusRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='169946124551****'),
}

model GetAccountDeletionStatusResponseBody = {
  rdAccountDeletionStatus?: {
    accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='169946124551****'),
    createTime?: string(name='CreateTime', description='The start time of the deletion.', example='2022-08-23T17:05:30+08:00'),
    deletionTime?: string(name='DeletionTime', description='The end time of the deletion.

This parameter is required.', example='2022-08-23T17:06:01+08:00'),
    deletionType?: string(name='DeletionType', description='The type of the deletion. Valid values:

*   0: direct deletion. If the member does not have pay-as-you-go resources that are purchased within the previous 30 days, the system directly deletes the member.
*   1: deletion with a silence period. If the member has pay-as-you-go resources that are purchased within the previous 30 days, the member enters a silence period of 45 days. The system starts to delete the member until the silence period ends. For more information about the silence period, see [What is the silence period for member deletion?](https://help.aliyun.com/document_detail/446079.html)', example='0'),
    failReasonList?: [ 
      {
        description?: string(name='Description', description='The description of the check item.', example='This account has a payer account. Please release the financial relationship of this account first.'),
        name?: string(name='Name', description='The name of the cloud service to which the check item belongs.', example='Others'),
      }
    ](name='FailReasonList', description='The reasons why the member fails to be deleted.'),
    status?: string(name='Status', description='The status. Valid values:

*   Success: The member is deleted.
*   Checking: A deletion check is being performed for the member.
*   Deleting: The member is being deleted.
*   CheckFailed: The deletion check for the member fails.
*   DeleteFailed: The member fails to be deleted.', example='Success'),
  }(name='RdAccountDeletionStatus', description='The deletion status of the member.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='8AA43293-7C8F-5730-8F2D-7F864EC092C5'),
}

model GetAccountDeletionStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAccountDeletionStatusResponseBody(name='body'),
}

/**
 * @summary Queries the deletion status of a member.
 *
 * @param request GetAccountDeletionStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAccountDeletionStatusResponse
 */
async function getAccountDeletionStatusWithOptions(request: GetAccountDeletionStatusRequest, runtime: $RuntimeOptions): GetAccountDeletionStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetAccountDeletionStatus',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the deletion status of a member.
 *
 * @param request GetAccountDeletionStatusRequest
 * @return GetAccountDeletionStatusResponse
 */
async function getAccountDeletionStatus(request: GetAccountDeletionStatusRequest): GetAccountDeletionStatusResponse {
  var runtime = new $RuntimeOptions{};
  return getAccountDeletionStatusWithOptions(request, runtime);
}

model GetControlPolicyRequest {
  language?: string(name='Language', description='The language in which you want to return the description of the access control policy. Valid values:

*   zh-CN (default value): Chinese
*   en: English
*   ja: Japanese

> This parameter is valid only for system access control policies.', example='zh-CN'),
  policyId?: string(name='PolicyId', description='The ID of the access control policy.

This parameter is required.', example='cp-SImPt8GCEwiq****'),
}

model GetControlPolicyResponseBody = {
  controlPolicy?: {
    attachmentCount?: string(name='AttachmentCount', description='The number of times that the access control policy is referenced.', example='0'),
    createDate?: string(name='CreateDate', description='The time when the access control policy was created.', example='2021-03-18T08:51:33Z'),
    description?: string(name='Description', description='The description of the access control policy.', example='ExampleControlPolicy'),
    effectScope?: string(name='EffectScope', description='The effective scope of the access control policy. Valid values:

*   All: The access control policy is in effect for Alibaba Cloud accounts, RAM users, and RAM roles.
*   RAM: The access control policy is in effect only for RAM users and RAM roles.', example='RAM'),
    policyDocument?: string(name='PolicyDocument', description='The document of the access control policy.', example='{\\\\"Version\\\\":\\\\"1\\\\",\\\\"Statement\\\\":[{\\\\"Effect\\\\":\\\\"Deny\\\\",\\\\"Action\\\\":[\\\\"ram:UpdateRole\\\\",\\\\"ram:DeleteRole\\\\",\\\\"ram:AttachPolicyToRole\\\\",\\\\"ram:DetachPolicyFromRole\\\\"],\\\\"Resource\\\\":\\\\"acs:ram:*:*:role/ResourceDirectoryAccountAccessRole\\\\"}]}'),
    policyId?: string(name='PolicyId', description='The ID of the access control policy.', example='cp-SImPt8GCEwiq****'),
    policyName?: string(name='PolicyName', description='The name of the access control policy.', example='test'),
    policyType?: string(name='PolicyType', description='The type of the access control policy. Valid values:

*   System: system access control policy
*   Custom: custom access control policy', example='Custom'),
    updateDate?: string(name='UpdateDate', description='The time when the access control policy was updated.', example='2021-03-18T08:51:33Z'),
  }(name='ControlPolicy', description='The details of the access control policy.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='AB769936-CDFA-4D52-8CE2-A3581800044A'),
}

model GetControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetControlPolicyResponseBody(name='body'),
}

/**
 * @summary Queries the details of an access control policy.
 *
 * @param request GetControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetControlPolicyResponse
 */
async function getControlPolicyWithOptions(request: GetControlPolicyRequest, runtime: $RuntimeOptions): GetControlPolicyResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the details of an access control policy.
 *
 * @param request GetControlPolicyRequest
 * @return GetControlPolicyResponse
 */
async function getControlPolicy(request: GetControlPolicyRequest): GetControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return getControlPolicyWithOptions(request, runtime);
}

model GetControlPolicyEnablementStatusResponseBody = {
  enablementStatus?: string(name='EnablementStatus', description='The status of the Control Policy feature. Valid values:

*   Enabled: The feature is enabled.
*   PendingEnable: The feature is being enabled.
*   Disabled: The feature is disabled.
*   PendingDisable: The feature is being disabled.', example='Disabled'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='1DC39A4E-3B52-4EFE-9F93-4897D7FFA0C4'),
}

model GetControlPolicyEnablementStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetControlPolicyEnablementStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of the Control Policy feature.
 *
 * @param request GetControlPolicyEnablementStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetControlPolicyEnablementStatusResponse
 */
async function getControlPolicyEnablementStatusWithOptions(runtime: $RuntimeOptions): GetControlPolicyEnablementStatusResponse {
  var req = new OpenApiUtil.OpenApiRequest{};
  var params = new OpenApiUtil.Params{
    action = 'GetControlPolicyEnablementStatus',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the status of the Control Policy feature.
 *
 * @return GetControlPolicyEnablementStatusResponse
 */
async function getControlPolicyEnablementStatus(): GetControlPolicyEnablementStatusResponse {
  var runtime = new $RuntimeOptions{};
  return getControlPolicyEnablementStatusWithOptions(runtime);
}

model GetFolderRequest {
  folderId?: string(name='FolderId', description='The ID of the folder.

This parameter is required.', example='fd-Jyl5U7****'),
}

model GetFolderResponseBody = {
  folder?: {
    createTime?: string(name='CreateTime', description='The time when the folder was created.', example='2021-06-15T06:39:08.521Z'),
    folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-Jyl5U7****'),
    folderName?: string(name='FolderName', description='The name of the folder.', example='Applications'),
    parentFolderId?: string(name='ParentFolderId', description='The ID of the parent folder.', example='r-Wm****'),
    resourceDirectoryPath?: string(name='ResourceDirectoryPath', description='The path of the folder in the resource directory.'),
  }(name='Folder', description='The information about the folder.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C2CBCA30-C8DD-423E-B4AD-4FB694C9180C'),
}

model GetFolderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFolderResponseBody(name='body'),
}

/**
 * @summary Queries the information about a folder.
 *
 * @param request GetFolderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFolderResponse
 */
async function getFolderWithOptions(request: GetFolderRequest, runtime: $RuntimeOptions): GetFolderResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.folderId)) {
    query['FolderId'] = request.folderId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetFolder',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about a folder.
 *
 * @param request GetFolderRequest
 * @return GetFolderResponse
 */
async function getFolder(request: GetFolderRequest): GetFolderResponse {
  var runtime = new $RuntimeOptions{};
  return getFolderWithOptions(request, runtime);
}

model GetHandshakeRequest {
  handshakeId?: string(name='HandshakeId', description='The ID of the invitation.

This parameter is required.', example='h-ycm4rp****'),
}

model GetHandshakeResponseBody = {
  handshake?: {
    createTime?: string(name='CreateTime', description='The time when the invitation was created. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
    expireTime?: string(name='ExpireTime', description='The time when the invitation expires. The time is displayed in UTC.', example='2018-08-24T09:55:41Z'),
    handshakeId?: string(name='HandshakeId', description='The ID of the invitation.', example='h-ycm4rp****'),
    invitedAccountRealName?: string(name='InvitedAccountRealName', description='The real-name verification information of the invitee.

> This parameter is available only when an invitee calls this operation.', example='Alice'),
    masterAccountId?: string(name='MasterAccountId', description='The ID of the management account of the resource directory.', example='172841235500****'),
    masterAccountName?: string(name='MasterAccountName', description='The name of the management account of the resource directory.', example='company@example.com'),
    masterAccountRealName?: string(name='MasterAccountRealName', description='The real-name verification information of the management account of the resource directory.

> This parameter is available only when an invitee calls this operation.', example='company'),
    modifyTime?: string(name='ModifyTime', description='The time when the invitation was modified. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
    note?: string(name='Note', description='The description of the invitation.', example='Welcome'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-abcdef****'),
    status?: string(name='Status', description='The status of the invitation. Valid values:

*   Pending: The invitation is waiting for confirmation.
*   Accepted: The invitation is accepted.
*   Cancelled: The invitation is canceled.
*   Declined: The invitation is rejected.
*   Expired: The invitation expires.', example='Pending'),
    targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the invited account.', example='someone@example.com'),
    targetType?: string(name='TargetType', description='The type of the invited account. Valid values:

*   Account: indicates the ID of the account.
*   Email: indicates the logon email address of the account.', example='Email'),
  }(name='Handshake', description='The information of the invitation.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model GetHandshakeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetHandshakeResponseBody(name='body'),
}

/**
 * @summary Queries the information of an invitation.
 *
 * @param request GetHandshakeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetHandshakeResponse
 */
async function getHandshakeWithOptions(request: GetHandshakeRequest, runtime: $RuntimeOptions): GetHandshakeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.handshakeId)) {
    query['HandshakeId'] = request.handshakeId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetHandshake',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information of an invitation.
 *
 * @param request GetHandshakeRequest
 * @return GetHandshakeResponse
 */
async function getHandshake(request: GetHandshakeRequest): GetHandshakeResponse {
  var runtime = new $RuntimeOptions{};
  return getHandshakeWithOptions(request, runtime);
}

model GetMessageContactRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.

This parameter is required.', example='c-qL4HqKONzOM7****'),
}

model GetMessageContactResponseBody = {
  contact?: {
    contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
    createDate?: string(name='CreateDate', description='The time when the contact was created.', example='2023-03-27 17:19:21'),
    emailAddress?: string(name='EmailAddress', description='The email address of the contact.', example='someone***@example.com'),
    members?: [ string ](name='Members', description='The IDs of objects to which the contact is bound.'),
    messageTypes?: [ string ](name='MessageTypes', description='The types of messages received by the contact.'),
    name?: string(name='Name', description='The name of the contact.', example='tom'),
    phoneNumber?: string(name='PhoneNumber', description='The mobile phone number of the contact.', example='86-139****1234'),
    status?: string(name='Status', description='The status of the contact. Valid values:

*   Verifying
*   Active
*   Deleting', example='Active'),
    title?: string(name='Title', description='The job title of the contact.', example='TechnicalDirector'),
  }(name='Contact', description='The information about the contact.'),
  requestId?: string(name='RequestId', description='The request ID.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model GetMessageContactResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMessageContactResponseBody(name='body'),
}

/**
 * @summary Queries the information about a contact.
 *
 * @param request GetMessageContactRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMessageContactResponse
 */
async function getMessageContactWithOptions(request: GetMessageContactRequest, runtime: $RuntimeOptions): GetMessageContactResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetMessageContact',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about a contact.
 *
 * @param request GetMessageContactRequest
 * @return GetMessageContactResponse
 */
async function getMessageContact(request: GetMessageContactRequest): GetMessageContactResponse {
  var runtime = new $RuntimeOptions{};
  return getMessageContactWithOptions(request, runtime);
}

model GetMessageContactDeletionStatusRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
}

model GetMessageContactDeletionStatusResponseBody = {
  contactDeletionStatus?: {
    contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
    failReasonList?: [ 
      {
        accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='199796839435****'),
        messageTypes?: [ string ](name='MessageTypes', description='The types of messages received by the contact.'),
      }
    ](name='FailReasonList', description='The types of messages received by the contact.'),
    status?: string(name='Status', description='The deletion status of the contact. Valid values:

*   Deleting
*   Failed', example='Deleting'),
  }(name='ContactDeletionStatus', description='The deletion information of the contact.'),
  requestId?: string(name='RequestId', description='The request ID.', example='95060F1D-6990-4645-8920-A81D1BBFE992'),
}

model GetMessageContactDeletionStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMessageContactDeletionStatusResponseBody(name='body'),
}

/**
 * @summary Queries the deletion status of a contact.
 *
 * @param request GetMessageContactDeletionStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMessageContactDeletionStatusResponse
 */
async function getMessageContactDeletionStatusWithOptions(request: GetMessageContactDeletionStatusRequest, runtime: $RuntimeOptions): GetMessageContactDeletionStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetMessageContactDeletionStatus',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the deletion status of a contact.
 *
 * @param request GetMessageContactDeletionStatusRequest
 * @return GetMessageContactDeletionStatusResponse
 */
async function getMessageContactDeletionStatus(request: GetMessageContactDeletionStatusRequest): GetMessageContactDeletionStatusResponse {
  var runtime = new $RuntimeOptions{};
  return getMessageContactDeletionStatusWithOptions(request, runtime);
}

model GetPayerForAccountRequest {
  accountId?: string(name='AccountId', description='The ID of the billing account.

This parameter is required.', example='12323344****'),
}

model GetPayerForAccountResponseBody = {
  payerAccountId?: string(name='PayerAccountId', description='The ID of the billing account.', example='172841235500****'),
  payerAccountName?: string(name='PayerAccountName', description='The name of the billing account.', example='Alice'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model GetPayerForAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPayerForAccountResponseBody(name='body'),
}

/**
 * @summary Queries the information of a billing account.
 *
 * @param request GetPayerForAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPayerForAccountResponse
 */
async function getPayerForAccountWithOptions(request: GetPayerForAccountRequest, runtime: $RuntimeOptions): GetPayerForAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetPayerForAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information of a billing account.
 *
 * @param request GetPayerForAccountRequest
 * @return GetPayerForAccountResponse
 */
async function getPayerForAccount(request: GetPayerForAccountRequest): GetPayerForAccountResponse {
  var runtime = new $RuntimeOptions{};
  return getPayerForAccountWithOptions(request, runtime);
}

model GetResourceDirectoryResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='CD76D376-2517-4924-92C5-DBC52262F93A'),
  resourceDirectory?: {
    controlPolicyStatus?: string(name='ControlPolicyStatus', description='The status of the Control Policy feature. Valid values:

- Enabled: The feature is enabled.
- PendingEnable: The feature is being enabled.
- Disabled: The feature is disabled.
- PendingDisable: The feature is being disabled.', example='Enabled'),
    createTime?: string(name='CreateTime', description='The time when the resource directory was enabled.', example='2019-02-18T15:32:10.473Z'),
    identityInformation?: string(name='IdentityInformation', description='The real-name verification information.', example='*** Co., Ltd.'),
    masterAccountId?: string(name='MasterAccountId', description='The ID of the management account.', example='172845045600****'),
    masterAccountName?: string(name='MasterAccountName', description='The name of the management account.', example='aliyun-admin'),
    memberAccountDisplayNameSyncStatus?: string(name='MemberAccountDisplayNameSyncStatus', description='The status of the Member Display Name Synchronization feature. Valid values:

*   Enabled
*   Disabled', example='Enabled'),
    memberDeletionStatus?: string(name='MemberDeletionStatus', description='The status of the member deletion feature. Valid values:

- Enabled: The feature is enabled. You can call the [DeleteAccount](~~DeleteAccount~~) operation to delete members of the resource account type.
- Disabled: The feature is disabled. You cannot delete members of the resource account type.', example='Enabled'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-St****'),
    rootFolderId?: string(name='RootFolderId', description='The ID of the Root folder.', example='r-Zo****'),
  }(name='ResourceDirectory', description='The information about the resource directory.'),
}

model GetResourceDirectoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetResourceDirectoryResponseBody(name='body'),
}

/**
 * @summary Queries the information of a resource directory. If you use a management account to call this API operation, the system returns the information of the resource directory that is enabled by using the management account. If you use a member to call this operation, the system returns the information of
 *
 * @param request GetResourceDirectoryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetResourceDirectoryResponse
 */
async function getResourceDirectoryWithOptions(runtime: $RuntimeOptions): GetResourceDirectoryResponse {
  var req = new OpenApiUtil.OpenApiRequest{};
  var params = new OpenApiUtil.Params{
    action = 'GetResourceDirectory',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information of a resource directory. If you use a management account to call this API operation, the system returns the information of the resource directory that is enabled by using the management account. If you use a member to call this operation, the system returns the information of
 *
 * @return GetResourceDirectoryResponse
 */
async function getResourceDirectory(): GetResourceDirectoryResponse {
  var runtime = new $RuntimeOptions{};
  return getResourceDirectoryWithOptions(runtime);
}

model InviteAccountToResourceDirectoryRequest {
  note?: string(name='Note', description='The description of the invitation.

The description can be up to 1,024 characters in length.', example='Welcome'),
  parentFolderId?: string(name='ParentFolderId', description='The ID of the parent folder.', example='r-b1****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='k1'),
      value?: string(name='Value', description='The tag value.', example='v1'),
    }
  ](name='Tag', description='The tags.'),
  targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the account that you want to invite.

This parameter is required.', example='someone@example.com'),
  targetType?: string(name='TargetType', description='The type of the invited account. Valid values:

*   Account: indicates the ID of the account.
*   Email: indicates the logon email address of the account.

This parameter is required.', example='Email'),
}

model InviteAccountToResourceDirectoryResponseBody = {
  handshake?: {
    createTime?: string(name='CreateTime', description='The time when the invitation was created. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
    expireTime?: string(name='ExpireTime', description='The time when the invitation expires. The time is displayed in UTC.', example='2018-08-24T09:55:41Z'),
    handshakeId?: string(name='HandshakeId', description='The ID of the invitation.', example='h-ycm4rp****'),
    masterAccountId?: string(name='MasterAccountId', description='The ID of the management account of the resource directory.', example='172841235500****'),
    masterAccountName?: string(name='MasterAccountName', description='The name of the management account of the resource directory.', example='Alice'),
    modifyTime?: string(name='ModifyTime', description='The time when the invitation was modified. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
    note?: string(name='Note', description='The description of the invitation.', example='Welcome'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-abcdef****'),
    status?: string(name='Status', description='The status of the invitation. Valid values:

*   Pending
*   Accepted
*   Cancelled
*   Declined
*   Expired', example='Pending'),
    targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the invited account.', example='someone@example.com'),
    targetType?: string(name='TargetType', description='The type of the invited account. Valid values:

*   Account: indicates the ID of the account.
*   Email: indicates the logon email address of the account.', example='Email'),
  }(name='Handshake', description='The information about the invitation.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model InviteAccountToResourceDirectoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InviteAccountToResourceDirectoryResponseBody(name='body'),
}

/**
 * @summary Invites an account to join a resource directory.
 *
 * @param request InviteAccountToResourceDirectoryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return InviteAccountToResourceDirectoryResponse
 */
async function inviteAccountToResourceDirectoryWithOptions(request: InviteAccountToResourceDirectoryRequest, runtime: $RuntimeOptions): InviteAccountToResourceDirectoryResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.note)) {
    query['Note'] = request.note;
  }
  if (!$isNull(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!$isNull(request.targetEntity)) {
    query['TargetEntity'] = request.targetEntity;
  }
  if (!$isNull(request.targetType)) {
    query['TargetType'] = request.targetType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'InviteAccountToResourceDirectory',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Invites an account to join a resource directory.
 *
 * @param request InviteAccountToResourceDirectoryRequest
 * @return InviteAccountToResourceDirectoryResponse
 */
async function inviteAccountToResourceDirectory(request: InviteAccountToResourceDirectoryRequest): InviteAccountToResourceDirectoryResponse {
  var runtime = new $RuntimeOptions{};
  return inviteAccountToResourceDirectoryWithOptions(request, runtime);
}

model ListAccountsRequest {
  includeTags?: boolean(name='IncludeTags', description='Specifies whether to return information about tags. Valid values:

*   false (default value)
*   true', example='true'),
  maxResults?: int32(name='MaxResults', description='The number of entries per page. After you configure this parameter, token-based paging is preferentially used.

Valid values: 1 to 100. Default value: 10.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. If you leave this parameter empty, the query starts from the beginning.', example='TGlzdFJlc291cm****'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  queryKeyword?: string(name='QueryKeyword', description='The keyword used for the query, such as the display name of a member.

Fuzzy match is supported.', example='Advance'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='tag_key'),
      value?: string(name='Value', description='The tag value.', example='tag_value'),
    }
  ](name='Tag', description='The tags. This parameter specifies a filter condition.'),
}

model ListAccountsResponseBody = {
  accounts?: {
    account?: [ 
    {
      accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='181761095690****'),
      accountName?: string(name='AccountName', description='The Alibaba Cloud account name of the member.', example='oxy01414357@alibaba-inc.com'),
      deletionStatus?: string(name='DeletionStatus', description='The deletion status of the member. Valid values:

*   Checking: A deletion check is being performed for the member.
*   Deleting: The member is being deleted.
*   CheckFailed: The deletion check for the member fails.
*   DeleteFailed: The member fails to be deleted.

>  If deletion is not performed for the member, the value of this parameter is empty.', example='Checking'),
      displayName?: string(name='DisplayName', description='The display name of the member.', example='test'),
      folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-QRzuim****'),
      joinMethod?: string(name='JoinMethod', description='The way in which the member joins the resource directory. Valid values:

*   invited: The member is invited to join the resource directory.
*   created: The member is directly created in the resource directory.', example='created'),
      joinTime?: string(name='JoinTime', description='The time when the member joined the resource directory. The time is displayed in UTC.', example='2021-01-18T08:01:50.522Z'),
      modifyTime?: string(name='ModifyTime', description='The time when the member was modified. The time is displayed in UTC.', example='2021-01-18T08:04:37.668Z'),
      resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-3G****'),
      resourceDirectoryPath?: string(name='ResourceDirectoryPath', description='The RDPath of the member.'),
      status?: string(name='Status', description='The status of the member. Valid values:

*   CreateSuccess: The member is created.
*   PromoteVerifying: The upgrade of the member is under confirmation.
*   PromoteFailed: The upgrade of the member fails.
*   PromoteExpired: The upgrade of the member expires.
*   PromoteCancelled: The upgrade of the member is canceled.
*   PromoteSuccess: The member is upgraded.
*   InviteSuccess: The member accepts the invitation.', example='CreateSuccess'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The key of the tag.', example='tag_key'),
          value?: string(name='Value', description='The value of the tag.', example='tag_value'),
        }
      ](name='Tag')
      }(name='Tags', description='The tags that are added to the member.'),
      type?: string(name='Type', description='The type of the member. Valid values:

*   CloudAccount: cloud account
*   ResourceAccount: resource account', example='ResourceAccount'),
    }
  ](name='Account')
  }(name='Accounts', description='The information about the members.'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='TGlzdFJlc291cm****'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='5'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='7B8A4E7D-6CFF-471D-84DF-195A7A241ECB'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAccountsResponseBody(name='body'),
}

/**
 * @summary Queries a list of members in a resource directory.
 *
 * @description You can use only the management account of a resource directory or a delegated administrator account of a trusted service to call this operation.
 *
 * @param request ListAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAccountsResponse
 */
async function listAccountsWithOptions(request: ListAccountsRequest, runtime: $RuntimeOptions): ListAccountsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.includeTags)) {
    query['IncludeTags'] = request.includeTags;
  }
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.queryKeyword)) {
    query['QueryKeyword'] = request.queryKeyword;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListAccounts',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries a list of members in a resource directory.
 *
 * @description You can use only the management account of a resource directory or a delegated administrator account of a trusted service to call this operation.
 *
 * @param request ListAccountsRequest
 * @return ListAccountsResponse
 */
async function listAccounts(request: ListAccountsRequest): ListAccountsResponse {
  var runtime = new $RuntimeOptions{};
  return listAccountsWithOptions(request, runtime);
}

model ListAccountsForParentRequest {
  includeTags?: boolean(name='IncludeTags', description='Specifies whether to return information about tags. Valid values:

*   false (default value)
*   true', example='true'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  parentFolderId?: string(name='ParentFolderId', description='The ID of the folder.', example='fd-bVaRIG****'),
  queryKeyword?: string(name='QueryKeyword', description='The keyword used for the query, such as the display name of a member.

Fuzzy match is supported.', example='admin'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='tag_key'),
      value?: string(name='Value', description='The value of the tag.', example='tag_value'),
    }
  ](name='Tag', description='The tags. This parameter specifies a filter condition.'),
}

model ListAccountsForParentResponseBody = {
  accounts?: {
    account?: [ 
    {
      accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='184311716100****'),
      accountName?: string(name='AccountName', description='The Alibaba Cloud account name of the member.', example='hdd01429358@alibaba-inc.com'),
      deletionStatus?: string(name='DeletionStatus', description='The deletion status of the member. Valid values:

*   Checking: A deletion check is being performed for the member.
*   Deleting: The member is being deleted.
*   CheckFailed: The deletion check for the member fails.
*   DeleteFailed: The member fails to be deleted.

>  If deletion is not performed for the member, the value of this parameter is empty.', example='Checking'),
      displayName?: string(name='DisplayName', description='The display name of the member.', example='admin'),
      folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-bVaRIG****'),
      joinMethod?: string(name='JoinMethod', description='The way in which the member joins the resource directory.

*   invited: The member is invited to join the resource directory.
*   created: The member is directly created in the resource directory.', example='created'),
      joinTime?: string(name='JoinTime', description='The time when the member joined the resource directory. The time is displayed in UTC.', example='2015-01-23T12:33:18Z'),
      modifyTime?: string(name='ModifyTime', description='The time when the member was modified. The time is displayed in UTC.', example='2015-01-23T12:33:18Z'),
      resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-k4****'),
      status?: string(name='Status', description='The status of the member. Valid values:

*   CreateSuccess: The member is created.
*   PromoteVerifying: The upgrade of the member is under confirmation.
*   PromoteFailed: The upgrade of the member fails.
*   PromoteExpired: The upgrade of the member expires.
*   PromoteCancelled: The upgrade of the member is canceled.
*   PromoteSuccess: The member is upgraded.
*   InviteSuccess: The member accepts the invitation.', example='CreateSuccess'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The key of the tag.', example='tag_key'),
          value?: string(name='Value', description='The value of the tag.', example='tag_value'),
        }
      ](name='Tag')
      }(name='Tags', description='The tags that are added to the member.'),
      type?: string(name='Type', description='The type of the member. Valid values:

*   CloudAccount: cloud account
*   ResourceAccount: resource account', example='ResourceAccount'),
    }
  ](name='Account')
  }(name='Accounts', description='The information about the members.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='5'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='7B8A4E7D-6CFF-471D-84DF-195A7A241ECB'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListAccountsForParentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAccountsForParentResponseBody(name='body'),
}

/**
 * @summary Queries the information of members in a folder.
 *
 * @param request ListAccountsForParentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAccountsForParentResponse
 */
async function listAccountsForParentWithOptions(request: ListAccountsForParentRequest, runtime: $RuntimeOptions): ListAccountsForParentResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.includeTags)) {
    query['IncludeTags'] = request.includeTags;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!$isNull(request.queryKeyword)) {
    query['QueryKeyword'] = request.queryKeyword;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListAccountsForParent',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information of members in a folder.
 *
 * @param request ListAccountsForParentRequest
 * @return ListAccountsForParentResponse
 */
async function listAccountsForParent(request: ListAccountsForParentRequest): ListAccountsForParentResponse {
  var runtime = new $RuntimeOptions{};
  return listAccountsForParentWithOptions(request, runtime);
}

model ListAncestorsRequest {
  childId?: string(name='ChildId', description='The ID of the subfolder.

This parameter is required.', example='fd-i1c9nr****'),
}

model ListAncestorsResponseBody = {
  folders?: {
    folder?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the folder was created.', example='2019-01-18T10:03:35.217Z'),
      folderId?: string(name='FolderId', description='The ID of the folder.', example='r-b1****'),
      folderName?: string(name='FolderName', description='The name of the folder.', example='root'),
    }
  ](name='Folder')
  }(name='Folders', description='The information of the folders.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='83AFBEB6-DC03-406E-9686-867461FF6698'),
}

model ListAncestorsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListAncestorsResponseBody(name='body'),
}

/**
 * @summary Queries the information of all the parent folders of a specified folder.
 *
 * @param request ListAncestorsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListAncestorsResponse
 */
async function listAncestorsWithOptions(request: ListAncestorsRequest, runtime: $RuntimeOptions): ListAncestorsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.childId)) {
    query['ChildId'] = request.childId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListAncestors',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information of all the parent folders of a specified folder.
 *
 * @param request ListAncestorsRequest
 * @return ListAncestorsResponse
 */
async function listAncestors(request: ListAncestorsRequest): ListAncestorsResponse {
  var runtime = new $RuntimeOptions{};
  return listAncestorsWithOptions(request, runtime);
}

model ListControlPoliciesRequest {
  language?: string(name='Language', description='The language in which you want to return the descriptions of the access control policies. Valid values:

*   zh-CN (default value): Chinese
*   en: English
*   ja: Japanese

> This parameter is available only for system access control policies.', example='zh-CN'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Page starts from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  policyType?: string(name='PolicyType', description='The type of the access control policies. Valid values:

*   System: system access control policy
*   Custom: custom access control policy', example='System'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='tag_key'),
      value?: string(name='Value', description='The tag value.', example='tag_value'),
    }
  ](name='Tag', description='The tags.'),
}

model ListControlPoliciesResponseBody = {
  controlPolicies?: {
    controlPolicy?: [ 
    {
      attachmentCount?: string(name='AttachmentCount', description='The number of times that the access control policy is referenced.', example='44'),
      createDate?: string(name='CreateDate', description='The time when the access control policy was created.', example='2020-08-05T06:32:24Z'),
      description?: string(name='Description', description='The description of the access control policy.', example='System access control policy available for all operations on the cloud'),
      effectScope?: string(name='EffectScope', description='The effective scope of the access control policy. Valid values:

*   All: The access control policy is in effect for Alibaba Cloud accounts, RAM users, and RAM roles.
*   RAM: The access control policy is in effect only for RAM users and RAM roles.', example='All'),
      policyId?: string(name='PolicyId', description='The ID of the access control policy.', example='cp-FullAliyunAccess'),
      policyName?: string(name='PolicyName', description='The name of the access control policy.', example='FullAliyunAccess'),
      policyType?: string(name='PolicyType', description='The type of the access control policy. Valid values:

*   System: system access control policy
*   Custom: custom access control policy', example='System'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The tag key.', example='tag_key'),
          value?: string(name='Value', description='The tag value.', example='tag_value'),
        }
      ](name='Tag')
      }(name='Tags', description='The tags.'),
      updateDate?: string(name='UpdateDate', description='The time when the access control policy was updated.', example='2020-08-05T06:32:24Z'),
    }
  ](name='ControlPolicy')
  }(name='ControlPolicies', description='The access control policies.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9424A34C-3471-45AD-B6AB-924BBDFE42F9'),
  totalCount?: int32(name='TotalCount', description='The number of access control policies.', example='1'),
}

model ListControlPoliciesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListControlPoliciesResponseBody(name='body'),
}

/**
 * @summary Queries access control policies.
 *
 * @param request ListControlPoliciesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListControlPoliciesResponse
 */
async function listControlPoliciesWithOptions(request: ListControlPoliciesRequest, runtime: $RuntimeOptions): ListControlPoliciesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.policyType)) {
    query['PolicyType'] = request.policyType;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListControlPolicies',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries access control policies.
 *
 * @param request ListControlPoliciesRequest
 * @return ListControlPoliciesResponse
 */
async function listControlPolicies(request: ListControlPoliciesRequest): ListControlPoliciesResponse {
  var runtime = new $RuntimeOptions{};
  return listControlPoliciesWithOptions(request, runtime);
}

model ListControlPolicyAttachmentsForTargetRequest {
  language?: string(name='Language', description='The language in which you want to return the descriptions of the access control policies. Valid values:

*   zh-CN (default value): Chinese
*   en: English
*   ja: Japanese

> This parameter is valid only for system access control policies.', example='zh-CN'),
  targetId?: string(name='TargetId', description='The ID of the object whose access control policies you want to query. Access control policies can be attached to the following objects:

*   Root folder
*   Subfolders of the Root folder
*   Members

This parameter is required.', example='fd-ZDNPiT****'),
}

model ListControlPolicyAttachmentsForTargetResponseBody = {
  controlPolicyAttachments?: {
    controlPolicyAttachment?: [ 
    {
      attachDate?: string(name='AttachDate', description='The time when the access control policy was attached.', example='2021-03-19T02:56:24Z'),
      description?: string(name='Description', description='The description of the access control policy.', example='ExampleControlPolicy'),
      effectScope?: string(name='EffectScope', description='The effective scope of the access control policy. Valid values:

*   All: The access control policy is in effect for Alibaba Cloud accounts, RAM users, and RAM roles.
*   RAM: The access control policy is in effect only for RAM users and RAM roles.', example='RAM'),
      policyId?: string(name='PolicyId', description='The ID of the access control policy.', example='cp-jExXAqIYkwHN****'),
      policyName?: string(name='PolicyName', description='The name of the access control policy.', example='ExampleControlPolicy'),
      policyType?: string(name='PolicyType', description='The type of the access control policy. Valid values:

*   System: system access control policy
*   Custom: custom access control policy', example='Custom'),
    }
  ](name='ControlPolicyAttachment')
  }(name='ControlPolicyAttachments', description='The information about the attached access control policies.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C276B600-7B7A-49E8-938C-E16CFA955A82'),
}

model ListControlPolicyAttachmentsForTargetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListControlPolicyAttachmentsForTargetResponseBody(name='body'),
}

/**
 * @summary Queries the access control policies that are attached to a folder or member.
 *
 * @param request ListControlPolicyAttachmentsForTargetRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListControlPolicyAttachmentsForTargetResponse
 */
async function listControlPolicyAttachmentsForTargetWithOptions(request: ListControlPolicyAttachmentsForTargetRequest, runtime: $RuntimeOptions): ListControlPolicyAttachmentsForTargetResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.targetId)) {
    query['TargetId'] = request.targetId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListControlPolicyAttachmentsForTarget',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the access control policies that are attached to a folder or member.
 *
 * @param request ListControlPolicyAttachmentsForTargetRequest
 * @return ListControlPolicyAttachmentsForTargetResponse
 */
async function listControlPolicyAttachmentsForTarget(request: ListControlPolicyAttachmentsForTargetRequest): ListControlPolicyAttachmentsForTargetResponse {
  var runtime = new $RuntimeOptions{};
  return listControlPolicyAttachmentsForTargetWithOptions(request, runtime);
}

model ListDelegatedAdministratorsRequest {
  pageNumber?: long(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  servicePrincipal?: string(name='ServicePrincipal', description='The identifier of the trusted service.

For more information, see the `Trusted service identifier` column in [Supported trusted services](https://help.aliyun.com/document_detail/208133.html).', example='cloudfw.aliyuncs.com'),
}

model ListDelegatedAdministratorsResponseBody = {
  accounts?: {
    account?: [ 
    {
      accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='138660628348****'),
      delegationEnabledTime?: string(name='DelegationEnabledTime', description='The time when the member was specified as a delegated administrator account.', example='1616652684164'),
      displayName?: string(name='DisplayName', description='The display name of the member.', example='abc'),
      joinMethod?: string(name='JoinMethod', description='The way in which the member joins the resource directory. Valid values:

*   invited: The member is invited to join the resource directory.
*   created: The member is directly created in the resource directory.', example='created'),
      servicePrincipal?: string(name='ServicePrincipal', description='The identifier of the trusted service.', example='cloudfw.aliyuncs.com'),
    }
  ](name='Account')
  }(name='Accounts', description='The information about the delegated administrator accounts.'),
  pageNumber?: long(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries returned per page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='009C3A02-7D4B-416C-9CE7-548C91508F1E'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListDelegatedAdministratorsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDelegatedAdministratorsResponseBody(name='body'),
}

/**
 * @summary Queries delegated administrator accounts.
 *
 * @param request ListDelegatedAdministratorsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDelegatedAdministratorsResponse
 */
async function listDelegatedAdministratorsWithOptions(request: ListDelegatedAdministratorsRequest, runtime: $RuntimeOptions): ListDelegatedAdministratorsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.servicePrincipal)) {
    query['ServicePrincipal'] = request.servicePrincipal;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListDelegatedAdministrators',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries delegated administrator accounts.
 *
 * @param request ListDelegatedAdministratorsRequest
 * @return ListDelegatedAdministratorsResponse
 */
async function listDelegatedAdministrators(request: ListDelegatedAdministratorsRequest): ListDelegatedAdministratorsResponse {
  var runtime = new $RuntimeOptions{};
  return listDelegatedAdministratorsWithOptions(request, runtime);
}

model ListDelegatedServicesForAccountRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='138660628348****'),
}

model ListDelegatedServicesForAccountResponseBody = {
  delegatedServices?: {
    delegatedService?: [ 
    {
      delegationEnabledTime?: string(name='DelegationEnabledTime', description='The time when the member was specified as a delegated administrator account.', example='1616652684164'),
      servicePrincipal?: string(name='ServicePrincipal', description='The identifier of the trusted service.', example='cloudfw.aliyuncs.com'),
      status?: string(name='Status', description='The status of the trusted service. Valid values:

*   ENABLED: enabled
*   DISABLED: disabled', example='ENABLED'),
    }
  ](name='DelegatedService')
  }(name='DelegatedServices', description='The information about the trusted services.

> If the value of this parameter is empty, the member is not specified as a delegated administrator account.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D9C03B94-9396-4794-A74B-13DC437556A6'),
}

model ListDelegatedServicesForAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDelegatedServicesForAccountResponseBody(name='body'),
}

/**
 * @summary Queries the trusted services for which a member is specified as a delegated administrator account.
 *
 * @param request ListDelegatedServicesForAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDelegatedServicesForAccountResponse
 */
async function listDelegatedServicesForAccountWithOptions(request: ListDelegatedServicesForAccountRequest, runtime: $RuntimeOptions): ListDelegatedServicesForAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListDelegatedServicesForAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the trusted services for which a member is specified as a delegated administrator account.
 *
 * @param request ListDelegatedServicesForAccountRequest
 * @return ListDelegatedServicesForAccountResponse
 */
async function listDelegatedServicesForAccount(request: ListDelegatedServicesForAccountRequest): ListDelegatedServicesForAccountResponse {
  var runtime = new $RuntimeOptions{};
  return listDelegatedServicesForAccountWithOptions(request, runtime);
}

model ListFoldersForParentRequest {
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  parentFolderId?: string(name='ParentFolderId', description='The ID of the parent folder.

If you leave this parameter empty, the information of the first-level subfolders of the Root folder is queried.', example='r-b1****'),
  queryKeyword?: string(name='QueryKeyword', description='The keyword used for the query, such as a folder name.

Fuzzy match is supported.', example='rdFolder'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='k1'),
      value?: string(name='Value', description='The value of the tag.', example='v1'),
    }
  ](name='Tag', description='The tags. This parameter specifies a filter condition.'),
}

model ListFoldersForParentResponseBody = {
  folders?: {
    folder?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the folder was created.', example='2015-01-23T12:33:18Z'),
      folderId?: string(name='FolderId', description='The ID of the folder.', example='rd-evic31****'),
      folderName?: string(name='FolderName', description='The name of the folder.', example='project-1'),
      tags?: {
        tag?: [ 
        {
          key?: string(name='Key', description='The key of the tag.', example='k1'),
          value?: string(name='Value', description='The value of the tag.', example='v1'),
        }
      ](name='Tag')
      }(name='Tags', description='The tags added to the folder.'),
    }
  ](name='Folder')
  }(name='Folders', description='The folders.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='5'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='7B8A4E7D-6CFF-471D-84DF-195A7A241ECB'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListFoldersForParentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFoldersForParentResponseBody(name='body'),
}

/**
 * @summary Queries the information of all subfolders of a folder.
 *
 * @description You can call this API operation to view the information of only the first-level subfolders of a folder.
 *
 * @param request ListFoldersForParentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFoldersForParentResponse
 */
async function listFoldersForParentWithOptions(request: ListFoldersForParentRequest, runtime: $RuntimeOptions): ListFoldersForParentResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.parentFolderId)) {
    query['ParentFolderId'] = request.parentFolderId;
  }
  if (!$isNull(request.queryKeyword)) {
    query['QueryKeyword'] = request.queryKeyword;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListFoldersForParent',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information of all subfolders of a folder.
 *
 * @description You can call this API operation to view the information of only the first-level subfolders of a folder.
 *
 * @param request ListFoldersForParentRequest
 * @return ListFoldersForParentResponse
 */
async function listFoldersForParent(request: ListFoldersForParentRequest): ListFoldersForParentResponse {
  var runtime = new $RuntimeOptions{};
  return listFoldersForParentWithOptions(request, runtime);
}

model ListHandshakesForAccountRequest {
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
}

model ListHandshakesForAccountResponseBody = {
  handshakes?: {
    handshake?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the invitation was created. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
      expireTime?: string(name='ExpireTime', description='The time when the invitation expires. The time is displayed in UTC.', example='2018-08-24T09:55:41Z'),
      handshakeId?: string(name='HandshakeId', description='The ID of the invitation.', example='h-4N57QZzCTtES****'),
      masterAccountId?: string(name='MasterAccountId', description='The ID of the management account of the resource directory.', example='172841235500****'),
      masterAccountName?: string(name='MasterAccountName', description='The name of the management account of the resource directory.', example='CompanyA'),
      modifyTime?: string(name='ModifyTime', description='The time when the invitation was modified. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
      note?: string(name='Note', description='The description of the invitation.', example='Welcome'),
      resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-abcdef****'),
      status?: string(name='Status', description='The status of the invitation. Valid values:

*   Pending: The invitation is waiting for confirmation.
*   Accepted: The invitation is accepted.
*   Cancelled: The invitation is canceled.
*   Declined: The invitation is rejected.
*   Expired: The invitation expires.', example='Pending'),
      targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the invited Alibaba Cloud account.', example='someone@example.com'),
      targetType?: string(name='TargetType', description='The type of the invited Alibaba Cloud account. Valid values:

*   Account: indicates the ID of the account.
*   Email: indicates the logon email address of the account.', example='Email'),
    }
  ](name='Handshake')
  }(name='Handshakes', description='The information of the invitations.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
  totalCount?: int32(name='TotalCount', description='The total number of invitations.', example='2'),
}

model ListHandshakesForAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListHandshakesForAccountResponseBody(name='body'),
}

/**
 * @summary Queries the invitations that are associated with an account.
 *
 * @param request ListHandshakesForAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListHandshakesForAccountResponse
 */
async function listHandshakesForAccountWithOptions(request: ListHandshakesForAccountRequest, runtime: $RuntimeOptions): ListHandshakesForAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListHandshakesForAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the invitations that are associated with an account.
 *
 * @param request ListHandshakesForAccountRequest
 * @return ListHandshakesForAccountResponse
 */
async function listHandshakesForAccount(request: ListHandshakesForAccountRequest): ListHandshakesForAccountResponse {
  var runtime = new $RuntimeOptions{};
  return listHandshakesForAccountWithOptions(request, runtime);
}

model ListHandshakesForResourceDirectoryRequest {
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
}

model ListHandshakesForResourceDirectoryResponseBody = {
  handshakes?: {
    handshake?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the invitation was created. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
      expireTime?: string(name='ExpireTime', description='The time when the invitation expires. The time is displayed in UTC.', example='2018-08-24T09:55:41Z'),
      handshakeId?: string(name='HandshakeId', description='The ID of the invitation.', example='h-ycm4rp****'),
      masterAccountId?: string(name='MasterAccountId', description='The ID of the management account of the resource directory.', example='172841235500****'),
      masterAccountName?: string(name='MasterAccountName', description='The name of the management account of the resource directory.', example='Alice'),
      modifyTime?: string(name='ModifyTime', description='The time when the invitation was modified. The time is displayed in UTC.', example='2018-08-10T09:55:41Z'),
      note?: string(name='Note', description='The description of the invitation.', example='Welcome'),
      resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-abcdef****'),
      status?: string(name='Status', description='The status of the invitation. Valid values:

*   Pending: The invitation is waiting for confirmation.
*   Accepted: The invitation is accepted.
*   Cancelled: The invitation is canceled.
*   Declined: The invitation is rejected.
*   Expired: The invitation expires.', example='Pending'),
      targetEntity?: string(name='TargetEntity', description='The ID or logon email address of the invited account.', example='someone@example.com'),
      targetType?: string(name='TargetType', description='The type of the invited account. Valid values:

*   Account: indicates the ID of the account.
*   Email: indicates the logon email address of the account.', example='Email'),
    }
  ](name='Handshake')
  }(name='Handshakes', description='The information of the invitations.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListHandshakesForResourceDirectoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListHandshakesForResourceDirectoryResponseBody(name='body'),
}

/**
 * @summary Queries invitations in a resource directory.
 *
 * @param request ListHandshakesForResourceDirectoryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListHandshakesForResourceDirectoryResponse
 */
async function listHandshakesForResourceDirectoryWithOptions(request: ListHandshakesForResourceDirectoryRequest, runtime: $RuntimeOptions): ListHandshakesForResourceDirectoryResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListHandshakesForResourceDirectory',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries invitations in a resource directory.
 *
 * @param request ListHandshakesForResourceDirectoryRequest
 * @return ListHandshakesForResourceDirectoryResponse
 */
async function listHandshakesForResourceDirectory(request: ListHandshakesForResourceDirectoryRequest): ListHandshakesForResourceDirectoryResponse {
  var runtime = new $RuntimeOptions{};
  return listHandshakesForResourceDirectoryWithOptions(request, runtime);
}

model ListMessageContactVerificationsRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
}

model ListMessageContactVerificationsResponseBody = {
  contactVerifications?: [ 
    {
      contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
      target?: string(name='Target', description='The object that is used for verification. Valid values:

- Mobile phone number
- Email address', example='someone***@example.com'),
    }
  ](name='ContactVerifications', description='The record for the contact to be verified.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='CD76D376-2517-4924-92C5-DBC52262F93A'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='48'),
}

model ListMessageContactVerificationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMessageContactVerificationsResponseBody(name='body'),
}

/**
 * @summary Queries the mobile phone number or email address to be verified for a contact.
 *
 * @param request ListMessageContactVerificationsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMessageContactVerificationsResponse
 */
async function listMessageContactVerificationsWithOptions(request: ListMessageContactVerificationsRequest, runtime: $RuntimeOptions): ListMessageContactVerificationsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListMessageContactVerifications',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the mobile phone number or email address to be verified for a contact.
 *
 * @param request ListMessageContactVerificationsRequest
 * @return ListMessageContactVerificationsResponse
 */
async function listMessageContactVerifications(request: ListMessageContactVerificationsRequest): ListMessageContactVerificationsResponse {
  var runtime = new $RuntimeOptions{};
  return listMessageContactVerificationsWithOptions(request, runtime);
}

model ListMessageContactsRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
  member?: string(name='Member', description='The ID of the object to which the contact is bound. Valid values:

*   ID of the resource directory
*   ID of the folder
*   ID of the member', example='fd-ZDNPiT****'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
}

model ListMessageContactsResponseBody = {
  contacts?: [ 
    {
      associatedDate?: string(name='AssociatedDate', description='The time when the contact was bound to the objects.', example='2023-03-27 17:19:21'),
      contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
      createDate?: string(name='CreateDate', description='The time when the contact was added.', example='2023-03-27 17:19:21'),
      emailAddress?: string(name='EmailAddress', description='The email address of the contact.', example='someone***@example.com'),
      members?: [ string ](name='Members', description='The IDs of objects to which the contact is bound.'),
      messageTypes?: [ string ](name='MessageTypes', description='The types of messages received by the contact.'),
      name?: string(name='Name', description='The name of the contact.', example='tom'),
      phoneNumber?: string(name='PhoneNumber', description='The mobile phone number of the contact.', example='86-139****1234'),
      status?: string(name='Status', description='The status of the contact. Valid values:

- Verifying
- Active
- Deleting', example='Active'),
      title?: string(name='Title', description='The job title of the contact.', example='TechnicalDirector'),
    }
  ](name='Contacts', description='The time when the contact was bound to the objects.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='95060F1D-6990-4645-8920-A81D1BBFE992'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='20'),
}

model ListMessageContactsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMessageContactsResponseBody(name='body'),
}

/**
 * @summary Queries contacts.
 *
 * @param request ListMessageContactsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMessageContactsResponse
 */
async function listMessageContactsWithOptions(request: ListMessageContactsRequest, runtime: $RuntimeOptions): ListMessageContactsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.member)) {
    query['Member'] = request.member;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListMessageContacts',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries contacts.
 *
 * @param request ListMessageContactsRequest
 * @return ListMessageContactsResponse
 */
async function listMessageContacts(request: ListMessageContactsRequest): ListMessageContactsResponse {
  var runtime = new $RuntimeOptions{};
  return listMessageContactsWithOptions(request, runtime);
}

model ListTagKeysRequest {
  keyFilter?: string(name='KeyFilter', description='The tag key for a fuzzy query.', example='team'),
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return for a single request.

Valid values: 1 to 100. Default value: 10.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request.', example='TGlzdFJlc291cm****'),
  resourceType?: string(name='ResourceType', description='The resource type.

The value Account indicates the members of the resource directory.

This parameter is required.', example='Account'),
}

model ListTagKeysResponseBody = {
  nextToken?: string(name='NextToken', description='Indicates whether the next query is required.

*   If the value of this parameter is empty (`"NextToken": ""`), all results are returned, and the next query is not required.
*   If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.', example='TGlzdFJlc291cm****'),
  requestId?: string(name='RequestId', description='The request ID.', example='DC09A6AA-2713-4E10-A2E9-E6C5C43A8842'),
  tags?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='team'),
    }
  ](name='Tags', description='The information about the tag keys.'),
}

model ListTagKeysResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagKeysResponseBody(name='body'),
}

/**
 * @summary Queries tag keys.
 *
 * @param request ListTagKeysRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagKeysResponse
 */
async function listTagKeysWithOptions(request: ListTagKeysRequest, runtime: $RuntimeOptions): ListTagKeysResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.keyFilter)) {
    query['KeyFilter'] = request.keyFilter;
  }
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTagKeys',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries tag keys.
 *
 * @param request ListTagKeysRequest
 * @return ListTagKeysResponse
 */
async function listTagKeys(request: ListTagKeysRequest): ListTagKeysResponse {
  var runtime = new $RuntimeOptions{};
  return listTagKeysWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  maxResults?: int32(name='MaxResults', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  nextToken?: string(name='NextToken', description='The token that is used to start the next query.', example='caeba0bbb2be03f84eb48b699f0a****'),
  resourceId?: [ string ](name='ResourceId', description='The Alibaba Cloud account IDs of the members. This parameter specifies a filter condition for the query.

> If you want to query the tags that are added to the members in a resource directory, you must configure both the `ResourceId` and `ResourceType` parameters and set the `ResourceType` parameter to `Account` in your request.'),
  resourceType?: string(name='ResourceType', description='The type of the objects whose tags you want to query. This parameter specifies a filter condition for the query. Valid values:

*   Account: member

This parameter is required.', example='Account'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='k1'),
      value?: string(name='Value', description='The value of the tag.', example='v1'),
    }
  ](name='Tag', description='The tags. This parameter specifies a filter condition for the query.

You can specify a maximum of 20 tags.'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', description='Indicates whether the next query is required.```` Valid values:

*   If the value of this parameter is empty (`"NextToken": ""`), all results are returned, and the `next query` is not required.
*   If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.````', example='caeba0bbb2be03f84eb48b699f0a****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='8054B059-6B36-53BF-AA45-B8C9A0ED05AB'),
  tagResources?: [ 
    {
      resourceId?: string(name='ResourceId', description='The Alibaba Cloud account ID of the member.', example='1098***'),
      resourceType?: string(name='ResourceType', description='The type of the object whose tags are queried. Valid values:

*   Account: member', example='Account'),
      tagKey?: string(name='TagKey', description='The key of the tag.', example='k1'),
      tagValue?: string(name='TagValue', description='The value of the tag.', example='k1'),
    }
  ](name='TagResources', description='The tags.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the tags that are added to the members in a resource directory.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: $RuntimeOptions): ListTagResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTagResources',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tags that are added to the members in a resource directory.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ListTagValuesRequest {
  maxResults?: int32(name='MaxResults', description='The maximum number of entries to return for a single request.

Valid values: 1 to 100. Default value: 10.', example='10'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request.', example='TGlzdFJlc291cm****'),
  resourceType?: string(name='ResourceType', description='The resource type.

The value Account indicates the members of the resource directory.

This parameter is required.', example='Account'),
  tagKey?: string(name='TagKey', description='The tag key. This parameter specifies a filter condition for the query.

This parameter is required.', example='k1'),
  valueFilter?: string(name='ValueFilter', description='The tag value for a fuzzy query.', example='v1'),
}

model ListTagValuesResponseBody = {
  nextToken?: string(name='NextToken', description='Indicates whether the next query is required.

*   If the value of this parameter is empty (`"NextToken": ""`), all results are returned, and the next query is not required.
*   If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.', example='TGlzdFJlc291cm****'),
  requestId?: string(name='RequestId', description='The request ID.', example='DC09A6AA-2713-4E10-A2E9-E6C5C43A8842'),
  tags?: [ 
    {
      value?: string(name='Value', description='The tag value.', example='v1'),
    }
  ](name='Tags', description='The information about the tag values.'),
}

model ListTagValuesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagValuesResponseBody(name='body'),
}

/**
 * @summary Queries the tag values of a tag key.
 *
 * @param request ListTagValuesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagValuesResponse
 */
async function listTagValuesWithOptions(request: ListTagValuesRequest, runtime: $RuntimeOptions): ListTagValuesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.maxResults)) {
    query['MaxResults'] = request.maxResults;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  if (!$isNull(request.valueFilter)) {
    query['ValueFilter'] = request.valueFilter;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTagValues',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tag values of a tag key.
 *
 * @param request ListTagValuesRequest
 * @return ListTagValuesResponse
 */
async function listTagValues(request: ListTagValuesRequest): ListTagValuesResponse {
  var runtime = new $RuntimeOptions{};
  return listTagValuesWithOptions(request, runtime);
}

model ListTargetAttachmentsForControlPolicyRequest {
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
  policyId?: string(name='PolicyId', description='The ID of the access control policy.

This parameter is required.', example='cp-jExXAqIYkwHN****'),
}

model ListTargetAttachmentsForControlPolicyResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B32BD3D6-1089-41F3-8E70-E0079BC7D760'),
  targetAttachments?: {
    targetAttachment?: [ 
    {
      attachDate?: string(name='AttachDate', description='The time when the access control policy was attached to the object.', example='2021-03-19T02:56:24Z'),
      targetId?: string(name='TargetId', description='The ID of the object.', example='fd-ZDNPiT****'),
      targetName?: string(name='TargetName', description='The name of the object.', example='Dev_Department'),
      targetType?: string(name='TargetType', description='The type of the object. Valid values:

*   Root: Root folder
*   Folder: subfolder of the Root folder
*   Account: member', example='Folder'),
    }
  ](name='TargetAttachment')
  }(name='TargetAttachments', description='The information about the objects to which the access control policy is attached.'),
  totalCount?: int32(name='TotalCount', description='The total number of objects to which the access control policy is attached.', example='1'),
}

model ListTargetAttachmentsForControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTargetAttachmentsForControlPolicyResponseBody(name='body'),
}

/**
 * @summary Queries the objects to which an access control policy is attached.
 *
 * @param request ListTargetAttachmentsForControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTargetAttachmentsForControlPolicyResponse
 */
async function listTargetAttachmentsForControlPolicyWithOptions(request: ListTargetAttachmentsForControlPolicyRequest, runtime: $RuntimeOptions): ListTargetAttachmentsForControlPolicyResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTargetAttachmentsForControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the objects to which an access control policy is attached.
 *
 * @param request ListTargetAttachmentsForControlPolicyRequest
 * @return ListTargetAttachmentsForControlPolicyResponse
 */
async function listTargetAttachmentsForControlPolicy(request: ListTargetAttachmentsForControlPolicyRequest): ListTargetAttachmentsForControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return listTargetAttachmentsForControlPolicyWithOptions(request, runtime);
}

model ListTrustedServiceStatusRequest {
  adminAccountId?: string(name='AdminAccountId', description='The ID of the management account or delegated administrator account.

*   If you set this parameter to the ID of a management account, the trusted services that are enabled within the management account are queried. The default value of this parameter is the ID of an management account.
*   If you set this parameter to the ID of a delegated administrator account, the trusted services that are enabled within the delegated administrator account are queried.

For more information about trusted services and delegated administrator accounts, see [Overview of trusted services](https://help.aliyun.com/document_detail/208133.html) and [Delegated administrator accounts](https://help.aliyun.com/document_detail/208117.html).', example='177242285274****'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return.

Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page.

Valid values: 1 to 100. Default value: 10.', example='10'),
}

model ListTrustedServiceStatusResponseBody = {
  enabledServicePrincipals?: {
    enabledServicePrincipal?: [ 
    {
      enableTime?: string(name='EnableTime', description='The time when the trusted service was enabled.', example='2019-02-18T15:32:10.473Z'),
      servicePrincipal?: string(name='ServicePrincipal', description='The identifier of the trusted service.', example='config.aliyuncs.com'),
    }
  ](name='EnabledServicePrincipal')
  }(name='EnabledServicePrincipals', description='The information about the trusted services that are enabled.'),
  pageNumber?: int32(name='PageNumber', description='The page number of the returned page.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='CD76D376-2517-4924-92C5-DBC52262F93A'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model ListTrustedServiceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTrustedServiceStatusResponseBody(name='body'),
}

/**
 * @summary Queries the trusted services that are enabled within a management account or delegated administrator account.
 *
 * @description Only a management account or delegated administrator account can be used to call this operation.
 *
 * @param request ListTrustedServiceStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTrustedServiceStatusResponse
 */
async function listTrustedServiceStatusWithOptions(request: ListTrustedServiceStatusRequest, runtime: $RuntimeOptions): ListTrustedServiceStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.adminAccountId)) {
    query['AdminAccountId'] = request.adminAccountId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTrustedServiceStatus',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the trusted services that are enabled within a management account or delegated administrator account.
 *
 * @description Only a management account or delegated administrator account can be used to call this operation.
 *
 * @param request ListTrustedServiceStatusRequest
 * @return ListTrustedServiceStatusResponse
 */
async function listTrustedServiceStatus(request: ListTrustedServiceStatusRequest): ListTrustedServiceStatusResponse {
  var runtime = new $RuntimeOptions{};
  return listTrustedServiceStatusWithOptions(request, runtime);
}

model MoveAccountRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member that you want to move.

This parameter is required.', example='12323344****'),
  destinationFolderId?: string(name='DestinationFolderId', description='The ID of the destination folder.

This parameter is required.', example='fd-bVaRIG****'),
}

model MoveAccountResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model MoveAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: MoveAccountResponseBody(name='body'),
}

/**
 * @summary Moves a member from a folder to another.
 *
 * @param request MoveAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return MoveAccountResponse
 */
async function moveAccountWithOptions(request: MoveAccountRequest, runtime: $RuntimeOptions): MoveAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.destinationFolderId)) {
    query['DestinationFolderId'] = request.destinationFolderId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'MoveAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Moves a member from a folder to another.
 *
 * @param request MoveAccountRequest
 * @return MoveAccountResponse
 */
async function moveAccount(request: MoveAccountRequest): MoveAccountResponse {
  var runtime = new $RuntimeOptions{};
  return moveAccountWithOptions(request, runtime);
}

model PrecheckForConsolidatedBillingAccountRequest {
  billingAccountId?: string(name='BillingAccountId', description='The ID of the management account or member to be used as a main financial account.

This parameter is required.', example='111***089'),
}

model PrecheckForConsolidatedBillingAccountResponseBody = {
  reasons?: [ 
    {
      code?: string(name='Code', description='The error code.', example='PaymentAccountEnterpriseInvoiceError'),
      message?: string(name='Message', description='The error message.', example='No enterprise invoice header information is set for the payment account.'),
    }
  ](name='Reasons', description='The cause of the check failure.'),
  requestId?: string(name='RequestId', description='The request ID.', example='9E6B6CA8-9E7A-521F-A743-AA582714727E'),
  result?: boolean(name='Result', description='Indicates whether the check was successful. Valid values:

*   true
*   false', example='false'),
}

model PrecheckForConsolidatedBillingAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PrecheckForConsolidatedBillingAccountResponseBody(name='body'),
}

/**
 * @summary Checks whether a management account or member can be used as a main financial account.
 *
 * @param request PrecheckForConsolidatedBillingAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PrecheckForConsolidatedBillingAccountResponse
 */
async function precheckForConsolidatedBillingAccountWithOptions(request: PrecheckForConsolidatedBillingAccountRequest, runtime: $RuntimeOptions): PrecheckForConsolidatedBillingAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.billingAccountId)) {
    query['BillingAccountId'] = request.billingAccountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'PrecheckForConsolidatedBillingAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Checks whether a management account or member can be used as a main financial account.
 *
 * @param request PrecheckForConsolidatedBillingAccountRequest
 * @return PrecheckForConsolidatedBillingAccountResponse
 */
async function precheckForConsolidatedBillingAccount(request: PrecheckForConsolidatedBillingAccountRequest): PrecheckForConsolidatedBillingAccountResponse {
  var runtime = new $RuntimeOptions{};
  return precheckForConsolidatedBillingAccountWithOptions(request, runtime);
}

model RegisterDelegatedAdministratorRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member in the resource directory.

This parameter is required.', example='181761095690****'),
  servicePrincipal?: string(name='ServicePrincipal', description='The identifier of the trusted service.

For more information, see the `Trusted service identifier` column in [Supported trusted services](https://help.aliyun.com/document_detail/208133.html).

This parameter is required.', example='cloudfw.aliyuncs.com'),
}

model RegisterDelegatedAdministratorResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0A45FC8F-54D2-4A65-8338-25E5DEBDA304'),
}

model RegisterDelegatedAdministratorResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RegisterDelegatedAdministratorResponseBody(name='body'),
}

/**
 * @summary Specifies a member in a resource directory as a delegated administrator account of a trusted service.
 *
 * @description The delegated administrator account can be used to access the information of the resource directory and view the structure and members of the resource directory. The delegated administrator account can also be used to perform service-related management operations in the trusted service on behalf of the management account of the resource directory. When you call this operation, you must take note of the following limits:
 * *   Only some trusted services support delegated administrator accounts. For more information, see [Supported trusted services](https://help.aliyun.com/document_detail/208133.html).
 * *   Only the management account of a resource directory or an authorized RAM user or RAM role of the management account can be used to call this operation.
 * *   The number of delegated administrator accounts that are allowed for a trusted service is defined by the trusted service.
 *
 * @param request RegisterDelegatedAdministratorRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RegisterDelegatedAdministratorResponse
 */
async function registerDelegatedAdministratorWithOptions(request: RegisterDelegatedAdministratorRequest, runtime: $RuntimeOptions): RegisterDelegatedAdministratorResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.servicePrincipal)) {
    query['ServicePrincipal'] = request.servicePrincipal;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'RegisterDelegatedAdministrator',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Specifies a member in a resource directory as a delegated administrator account of a trusted service.
 *
 * @description The delegated administrator account can be used to access the information of the resource directory and view the structure and members of the resource directory. The delegated administrator account can also be used to perform service-related management operations in the trusted service on behalf of the management account of the resource directory. When you call this operation, you must take note of the following limits:
 * *   Only some trusted services support delegated administrator accounts. For more information, see [Supported trusted services](https://help.aliyun.com/document_detail/208133.html).
 * *   Only the management account of a resource directory or an authorized RAM user or RAM role of the management account can be used to call this operation.
 * *   The number of delegated administrator accounts that are allowed for a trusted service is defined by the trusted service.
 *
 * @param request RegisterDelegatedAdministratorRequest
 * @return RegisterDelegatedAdministratorResponse
 */
async function registerDelegatedAdministrator(request: RegisterDelegatedAdministratorRequest): RegisterDelegatedAdministratorResponse {
  var runtime = new $RuntimeOptions{};
  return registerDelegatedAdministratorWithOptions(request, runtime);
}

model RemoveCloudAccountRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='177242285274****'),
}

model RemoveCloudAccountResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model RemoveCloudAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RemoveCloudAccountResponseBody(name='body'),
}

/**
 * @summary Removes a member of the cloud account type.
 *
 * @param request RemoveCloudAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RemoveCloudAccountResponse
 */
async function removeCloudAccountWithOptions(request: RemoveCloudAccountRequest, runtime: $RuntimeOptions): RemoveCloudAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'RemoveCloudAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Removes a member of the cloud account type.
 *
 * @param request RemoveCloudAccountRequest
 * @return RemoveCloudAccountResponse
 */
async function removeCloudAccount(request: RemoveCloudAccountRequest): RemoveCloudAccountResponse {
  var runtime = new $RuntimeOptions{};
  return removeCloudAccountWithOptions(request, runtime);
}

model RetryChangeAccountEmailRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='181761095690****'),
}

model RetryChangeAccountEmailResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model RetryChangeAccountEmailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RetryChangeAccountEmailResponseBody(name='body'),
}

/**
 * @summary Resends a verification email for the email address change of a member.
 *
 * @param request RetryChangeAccountEmailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RetryChangeAccountEmailResponse
 */
async function retryChangeAccountEmailWithOptions(request: RetryChangeAccountEmailRequest, runtime: $RuntimeOptions): RetryChangeAccountEmailResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'RetryChangeAccountEmail',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Resends a verification email for the email address change of a member.
 *
 * @param request RetryChangeAccountEmailRequest
 * @return RetryChangeAccountEmailResponse
 */
async function retryChangeAccountEmail(request: RetryChangeAccountEmailRequest): RetryChangeAccountEmailResponse {
  var runtime = new $RuntimeOptions{};
  return retryChangeAccountEmailWithOptions(request, runtime);
}

model SendEmailVerificationForMessageContactRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-5gsZAGt***PGduDF'),
  emailAddress?: string(name='EmailAddress', description='The email address of the contact.

The specified email address must be the one you specify when you call [AddMessageContact](~~AddMessageContact~~).', example='someone***@example.com'),
}

model SendEmailVerificationForMessageContactResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='7B8A4E7D-6CFF-471D-84DF-195A7A241ECB'),
}

model SendEmailVerificationForMessageContactResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendEmailVerificationForMessageContactResponseBody(name='body'),
}

/**
 * @summary Sends verification information to the email address of a contact.
 *
 * @param request SendEmailVerificationForMessageContactRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendEmailVerificationForMessageContactResponse
 */
async function sendEmailVerificationForMessageContactWithOptions(request: SendEmailVerificationForMessageContactRequest, runtime: $RuntimeOptions): SendEmailVerificationForMessageContactResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.emailAddress)) {
    query['EmailAddress'] = request.emailAddress;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SendEmailVerificationForMessageContact',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Sends verification information to the email address of a contact.
 *
 * @param request SendEmailVerificationForMessageContactRequest
 * @return SendEmailVerificationForMessageContactResponse
 */
async function sendEmailVerificationForMessageContact(request: SendEmailVerificationForMessageContactRequest): SendEmailVerificationForMessageContactResponse {
  var runtime = new $RuntimeOptions{};
  return sendEmailVerificationForMessageContactWithOptions(request, runtime);
}

model SendPhoneVerificationForMessageContactRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
  phoneNumber?: string(name='PhoneNumber', description='The mobile phone number of the contact.

The value must be in the `<Country code>-<Mobile phone number>` format.

The specified mobile phone number must be the one you specify when you call the [AddMessageContact](~~AddMessageContact~~) operation.', example='86-139****1234'),
}

model SendPhoneVerificationForMessageContactResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='CD76D376-2517-4924-92C5-DBC52262F93A'),
}

model SendPhoneVerificationForMessageContactResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendPhoneVerificationForMessageContactResponseBody(name='body'),
}

/**
 * @summary Sends verification information to the mobile phone number of a contact.
 *
 * @param request SendPhoneVerificationForMessageContactRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendPhoneVerificationForMessageContactResponse
 */
async function sendPhoneVerificationForMessageContactWithOptions(request: SendPhoneVerificationForMessageContactRequest, runtime: $RuntimeOptions): SendPhoneVerificationForMessageContactResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SendPhoneVerificationForMessageContact',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Sends verification information to the mobile phone number of a contact.
 *
 * @param request SendPhoneVerificationForMessageContactRequest
 * @return SendPhoneVerificationForMessageContactResponse
 */
async function sendPhoneVerificationForMessageContact(request: SendPhoneVerificationForMessageContactRequest): SendPhoneVerificationForMessageContactResponse {
  var runtime = new $RuntimeOptions{};
  return sendPhoneVerificationForMessageContactWithOptions(request, runtime);
}

model SendVerificationCodeForBindSecureMobilePhoneRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='138660628348****'),
  secureMobilePhone?: string(name='SecureMobilePhone', description='The mobile phone number that you want to bind to the member for security purposes.

Specify the mobile phone number in the \\\\<Country code>-\\\\<Mobile phone number> format.

> Mobile phone numbers in the `86-<Mobile phone number>` format in the Chinese mainland are not supported.

This parameter is required.', example='xx-13900001234'),
}

model SendVerificationCodeForBindSecureMobilePhoneResponseBody = {
  expirationDate?: string(name='ExpirationDate', description='The time when the verification code expires.', example='2021-12-17T07:38:41.747Z'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='DCD43660-75DD-5D15-B342-1B83FCA5B913'),
}

model SendVerificationCodeForBindSecureMobilePhoneResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendVerificationCodeForBindSecureMobilePhoneResponseBody(name='body'),
}

/**
 * @summary Sends a verification code to the mobile phone number that you want to bind to a member of the resource account type in a resource directory for security purposes.
 *
 * @description To ensure that the system can record the operators of management operations, you must use a RAM user or RAM role to which the AliyunResourceDirectoryFullAccess policy is attached within the management account of your resource directory to call this API operation.
 *
 * @param request SendVerificationCodeForBindSecureMobilePhoneRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendVerificationCodeForBindSecureMobilePhoneResponse
 */
async function sendVerificationCodeForBindSecureMobilePhoneWithOptions(request: SendVerificationCodeForBindSecureMobilePhoneRequest, runtime: $RuntimeOptions): SendVerificationCodeForBindSecureMobilePhoneResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.secureMobilePhone)) {
    query['SecureMobilePhone'] = request.secureMobilePhone;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SendVerificationCodeForBindSecureMobilePhone',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Sends a verification code to the mobile phone number that you want to bind to a member of the resource account type in a resource directory for security purposes.
 *
 * @description To ensure that the system can record the operators of management operations, you must use a RAM user or RAM role to which the AliyunResourceDirectoryFullAccess policy is attached within the management account of your resource directory to call this API operation.
 *
 * @param request SendVerificationCodeForBindSecureMobilePhoneRequest
 * @return SendVerificationCodeForBindSecureMobilePhoneResponse
 */
async function sendVerificationCodeForBindSecureMobilePhone(request: SendVerificationCodeForBindSecureMobilePhoneRequest): SendVerificationCodeForBindSecureMobilePhoneResponse {
  var runtime = new $RuntimeOptions{};
  return sendVerificationCodeForBindSecureMobilePhoneWithOptions(request, runtime);
}

model SendVerificationCodeForEnableRDRequest {
  secureMobilePhone?: string(name='SecureMobilePhone', description='The mobile phone number that is bound to the newly created account. If you leave this parameter empty, the mobile phone number that is bound to the current account is used.

Specify the mobile phone number in the `<Country code>-<Mobile phone number>` format.

> Mobile phone numbers in the `86-<Mobile phone number>` format in the Chinese mainland are not supported.', example='xx-13900001234'),
}

model SendVerificationCodeForEnableRDResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='EC2FE94D-A4A2-51A1-A493-5C273A36C46A'),
}

model SendVerificationCodeForEnableRDResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendVerificationCodeForEnableRDResponseBody(name='body'),
}

/**
 * @summary Sends a verification code to the mobile phone number bound to a newly created account when you use the account to enable a resource directory.
 *
 * @description Each Alibaba Cloud account can be used to send a maximum of 100 verification codes per day.
 *
 * @param request SendVerificationCodeForEnableRDRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendVerificationCodeForEnableRDResponse
 */
async function sendVerificationCodeForEnableRDWithOptions(request: SendVerificationCodeForEnableRDRequest, runtime: $RuntimeOptions): SendVerificationCodeForEnableRDResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.secureMobilePhone)) {
    query['SecureMobilePhone'] = request.secureMobilePhone;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SendVerificationCodeForEnableRD',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Sends a verification code to the mobile phone number bound to a newly created account when you use the account to enable a resource directory.
 *
 * @description Each Alibaba Cloud account can be used to send a maximum of 100 verification codes per day.
 *
 * @param request SendVerificationCodeForEnableRDRequest
 * @return SendVerificationCodeForEnableRDResponse
 */
async function sendVerificationCodeForEnableRD(request: SendVerificationCodeForEnableRDRequest): SendVerificationCodeForEnableRDResponse {
  var runtime = new $RuntimeOptions{};
  return sendVerificationCodeForEnableRDWithOptions(request, runtime);
}

model SetMemberDeletionPermissionRequest {
  status?: string(name='Status', description='Specifies whether to enable the member deletion feature. Valid values:

*   Enabled: enables the member deletion feature.
*   Disabled: disables the member deletion feature.

This parameter is required.', example='Enabled'),
}

model SetMemberDeletionPermissionResponseBody = {
  managementAccountId?: string(name='ManagementAccountId', description='The ID of the management account of the resource directory.', example='151266687691****'),
  memberDeletionStatus?: string(name='MemberDeletionStatus', description='The status of the member deletion feature. Valid values:

*   Enabled: The feature is enabled.
*   Disabled: The feature is disabled.', example='Enabled'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C55A4CAA-9039-1DDF-91CE-FCC134513D29'),
  resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-3G****'),
}

model SetMemberDeletionPermissionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetMemberDeletionPermissionResponseBody(name='body'),
}

/**
 * @summary Enables or disables the member deletion feature.
 *
 * @description Members of the resource account type can be deleted only after the member deletion feature is enabled.
 *
 * @param request SetMemberDeletionPermissionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetMemberDeletionPermissionResponse
 */
async function setMemberDeletionPermissionWithOptions(request: SetMemberDeletionPermissionRequest, runtime: $RuntimeOptions): SetMemberDeletionPermissionResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SetMemberDeletionPermission',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enables or disables the member deletion feature.
 *
 * @description Members of the resource account type can be deleted only after the member deletion feature is enabled.
 *
 * @param request SetMemberDeletionPermissionRequest
 * @return SetMemberDeletionPermissionResponse
 */
async function setMemberDeletionPermission(request: SetMemberDeletionPermissionRequest): SetMemberDeletionPermissionResponse {
  var runtime = new $RuntimeOptions{};
  return setMemberDeletionPermissionWithOptions(request, runtime);
}

model SetMemberDisplayNameSyncStatusRequest {
  status?: string(name='Status', description='The status of the Member Display Name Synchronization feature. Valid values:

*   Enabled: The feature is enabled. This indicates that the display names specified by the management account for the members will be synchronized to the basic account information of the members. The display name information will be visible and perceptible to the members. If a notification is sent to a member, the display name of the member will be used as the appellation of the member.
*   Disabled: The feature is disabled. This indicates that the display names specified by the management account for the members are valid only in the resource directory and will not be updated to the basic account information of the members.

This parameter is required.', example='Enabled'),
}

model SetMemberDisplayNameSyncStatusResponseBody = {
  memberAccountDisplayNameSyncStatus?: string(name='MemberAccountDisplayNameSyncStatus', description='The status of the Member Display Name Synchronization feature. Valid values:

*   Enabled
*   Disabled', example='Enabled'),
  requestId?: string(name='RequestId', description='The request ID.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model SetMemberDisplayNameSyncStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetMemberDisplayNameSyncStatusResponseBody(name='body'),
}

/**
 * @summary Enables or disables the Member Display Name Synchronization feature.
 *
 * @param request SetMemberDisplayNameSyncStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SetMemberDisplayNameSyncStatusResponse
 */
async function setMemberDisplayNameSyncStatusWithOptions(request: SetMemberDisplayNameSyncStatusRequest, runtime: $RuntimeOptions): SetMemberDisplayNameSyncStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SetMemberDisplayNameSyncStatus',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enables or disables the Member Display Name Synchronization feature.
 *
 * @param request SetMemberDisplayNameSyncStatusRequest
 * @return SetMemberDisplayNameSyncStatusResponse
 */
async function setMemberDisplayNameSyncStatus(request: SetMemberDisplayNameSyncStatusRequest): SetMemberDisplayNameSyncStatusResponse {
  var runtime = new $RuntimeOptions{};
  return setMemberDisplayNameSyncStatusWithOptions(request, runtime);
}

model TagResourcesRequest {
  resourceId?: [ string ](name='ResourceId', description='The Alibaba Cloud account IDs of the members.

You can specify a maximum of 50 IDs.

This parameter is required.'),
  resourceType?: string(name='ResourceType', description='The type of the objects to which you want to add tags. Valid values:

*   Account: member

This parameter is required.', example='Account'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.

A tag key can be a maximum of 128 characters in length. It cannot contain `http://` or `https://` and cannot start with `acs:` or `aliyun`.', example='k1'),
      value?: string(name='Value', description='The value of the tag.

A tag value can be a maximum of 128 characters in length. It cannot contain `http://` or `https://` and cannot start with `acs:`.', example='v1'),
    }
  ](name='Tag', description='The tags.

You can specify a maximum of 20 tags.

This parameter is required.'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='E7747EDF-EDDC-5B38-9B6A-6392B9C92B1C'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Adds tags to the members in a resource directory.
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: $RuntimeOptions): TagResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'TagResources',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Adds tags to the members in a resource directory.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', description='Specifies whether to remove all tags from the specified members. Valid values:

*   false (default value)
*   true', example='false'),
  resourceId?: [ string ](name='ResourceId', description='The Alibaba Cloud account IDs of the members.

You can specify a maximum of 50 IDs.

This parameter is required.'),
  resourceType?: string(name='ResourceType', description='The type of the objects from which you want to remove tags. Valid values:

*   Account: member

This parameter is required.', example='Account'),
  tagKey?: [ string ](name='TagKey', description='The tag keys.

You can specify a maximum of 20 tag keys.

> If you set the `All` parameter to `true`, you do not need to specify tag keys.'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='E7747EDF-EDDC-5B38-9B6A-6392B9C92B1C'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Removes tags from the members in a resource directory.
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: $RuntimeOptions): UntagResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.all)) {
    query['All'] = request.all;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UntagResources',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Removes tags from the members in a resource directory.
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

model UpdateAccountRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='12323344****'),
  dryRun?: boolean(name='DryRun', description='Specifies whether to perform only a dry run, without performing the actual request. Valid values:

*   true: performs only a dry run. The system checks items such as whether the member status can be modified and whether security information is configured for the member. If the request does not pass the dry run, an error code is returned.
*   false (default): performs a dry run and performs the actual request.', example='false'),
  newAccountType?: string(name='NewAccountType', description='The new type of the member. Valid values:

*   ResourceAccount: resource account
*   CloudAccount: cloud account

> You can specify either `NewDisplayName` or `NewAccountType`.', example='ResourceAccount'),
  newDisplayName?: string(name='NewDisplayName', description='The new display name of the member.

> You can specify either `NewDisplayName` or `NewAccountType`.', example='admin'),
}

model UpdateAccountResponseBody = {
  account?: {
    accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.', example='12323344****'),
    accountName?: string(name='AccountName', description='The Alibaba Cloud account name of the member.', example='ecs-manager@aliyun.com'),
    displayName?: string(name='DisplayName', description='The display name of the member.', example='admin'),
    folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-bVaRIG****'),
    joinMethod?: string(name='JoinMethod', description='The way in which the member joins the resource directory. Valid values:

*   invited: The member is invited to join the resource directory.
*   created: The member is directly created in the resource directory.', example='created'),
    joinTime?: string(name='JoinTime', description='The time when the member joined the resource directory. The time is displayed in UTC.', example='2015-01-23T12:33:18Z'),
    modifyTime?: string(name='ModifyTime', description='The time when the member was modified. The time is displayed in UTC.', example='2015-01-23T12:33:18Z'),
    resourceDirectoryId?: string(name='ResourceDirectoryId', description='The ID of the resource directory.', example='rd-k3****'),
    status?: string(name='Status', description='The status of the member. Valid values:

*   CreateSuccess: The member is created.
*   InviteSuccess: The member accepts the invitation.
*   Removed: The member is removed.
*   SwitchSuccess: The type of the member is switched.', example='CreateSuccess'),
    type?: string(name='Type', description='The type of the member. Valid values:

*   CloudAccount: cloud account
*   ResourceAccount: resource account', example='ResourceAccount'),
  }(name='Account', description='The information of the member.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model UpdateAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAccountResponseBody(name='body'),
}

/**
 * @summary Changes the display name of a member, or switches the type of a member.
 *
 * @description *   To ensure that the system can record the operators of management operations, you must use a RAM user or RAM role to which the AliyunResourceDirectoryFullAccess policy is attached within the management account of your resource directory to call this operation.
 * *   Before you switch the type of a member from resource account to cloud account, make sure that specific conditions are met. For more information about the conditions, see [Switch a resource account to a cloud account](https://help.aliyun.com/document_detail/111233.html).
 * *   Before you switch the type of a member from cloud account to resource account, make sure that specific conditions are met. For more information about the conditions, see [Switch a cloud account to a resource account](https://help.aliyun.com/document_detail/209980.html).
 *
 * @param request UpdateAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAccountResponse
 */
async function updateAccountWithOptions(request: UpdateAccountRequest, runtime: $RuntimeOptions): UpdateAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.dryRun)) {
    query['DryRun'] = request.dryRun;
  }
  if (!$isNull(request.newAccountType)) {
    query['NewAccountType'] = request.newAccountType;
  }
  if (!$isNull(request.newDisplayName)) {
    query['NewDisplayName'] = request.newDisplayName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Changes the display name of a member, or switches the type of a member.
 *
 * @description *   To ensure that the system can record the operators of management operations, you must use a RAM user or RAM role to which the AliyunResourceDirectoryFullAccess policy is attached within the management account of your resource directory to call this operation.
 * *   Before you switch the type of a member from resource account to cloud account, make sure that specific conditions are met. For more information about the conditions, see [Switch a resource account to a cloud account](https://help.aliyun.com/document_detail/111233.html).
 * *   Before you switch the type of a member from cloud account to resource account, make sure that specific conditions are met. For more information about the conditions, see [Switch a cloud account to a resource account](https://help.aliyun.com/document_detail/209980.html).
 *
 * @param request UpdateAccountRequest
 * @return UpdateAccountResponse
 */
async function updateAccount(request: UpdateAccountRequest): UpdateAccountResponse {
  var runtime = new $RuntimeOptions{};
  return updateAccountWithOptions(request, runtime);
}

model UpdateControlPolicyRequest {
  newDescription?: string(name='NewDescription', description='The new description of the access control policy.

The description must be 1 to 1,024 characters in length. The description can contain letters, digits, underscores (_), and hyphens (-) and must start with a letter.', example='ExampleControlPolicy'),
  newPolicyDocument?: string(name='NewPolicyDocument', description='The new document of the access control policy.

The document can be a maximum of 4,096 characters in length.

For more information about the languages of access control policies, see [Languages of access control policies](https://help.aliyun.com/document_detail/179096.html).

For more information about the examples of access control policies, see [Examples of custom access control policies](https://help.aliyun.com/document_detail/181474.html).', example='{"Version":"1","Statement":[{"Effect":"Deny","Action":["ram:UpdateRole","ram:DeleteRole","ram:AttachPolicyToRole","ram:DetachPolicyFromRole"],"Resource":"acs:ram:*:*:role/ResourceDirectoryAccountAccessRole"}]}'),
  newPolicyName?: string(name='NewPolicyName', description='The new name of the access control policy.

The name must be 1 to 128 characters in length. The name can contain letters, digits, and hyphens (-) and must start with a letter.', example='NewControlPolicy'),
  policyId?: string(name='PolicyId', description='The ID of the access control policy.

This parameter is required.', example='cp-jExXAqIYkwHN****'),
}

model UpdateControlPolicyResponseBody = {
  controlPolicy?: {
    attachmentCount?: string(name='AttachmentCount', description='The number of times that the access control policy is referenced.', example='0'),
    createDate?: string(name='CreateDate', description='The time when the access control policy was created.', example='2021-03-18T09:24:19Z'),
    description?: string(name='Description', description='The description of the access control policy.', example='ExampleControlPolicy'),
    effectScope?: string(name='EffectScope', description='The effective scope of the access control policy. Valid values:

*   All: The access control policy is in effect for Alibaba Cloud accounts, RAM users, and RAM roles.
*   RAM: The access control policy is in effect only for RAM users and RAM roles.', example='RAM'),
    policyId?: string(name='PolicyId', description='The ID of the access control policy.', example='cp-jExXAqIYkwHN****'),
    policyName?: string(name='PolicyName', description='The name of the access control policy.', example='NewControlPolicy'),
    policyType?: string(name='PolicyType', description='The type of the access control policy. Valid values:

*   System: system access control policy
*   Custom: custom access control policy', example='Custom'),
    updateDate?: string(name='UpdateDate', description='The time when the access control policy was updated.', example='2021-03-18T10:04:55Z'),
  }(name='ControlPolicy', description='The details of the access control policy.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='2DFCE4C9-04A9-4C83-BB14-FE791275EC53'),
}

model UpdateControlPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateControlPolicyResponseBody(name='body'),
}

/**
 * @summary Updates a custom access control policy.
 *
 * @param request UpdateControlPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateControlPolicyResponse
 */
async function updateControlPolicyWithOptions(request: UpdateControlPolicyRequest, runtime: $RuntimeOptions): UpdateControlPolicyResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.newDescription)) {
    query['NewDescription'] = request.newDescription;
  }
  if (!$isNull(request.newPolicyDocument)) {
    query['NewPolicyDocument'] = request.newPolicyDocument;
  }
  if (!$isNull(request.newPolicyName)) {
    query['NewPolicyName'] = request.newPolicyName;
  }
  if (!$isNull(request.policyId)) {
    query['PolicyId'] = request.policyId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateControlPolicy',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates a custom access control policy.
 *
 * @param request UpdateControlPolicyRequest
 * @return UpdateControlPolicyResponse
 */
async function updateControlPolicy(request: UpdateControlPolicyRequest): UpdateControlPolicyResponse {
  var runtime = new $RuntimeOptions{};
  return updateControlPolicyWithOptions(request, runtime);
}

model UpdateFolderRequest {
  folderId?: string(name='FolderId', description='The ID of the folder.

This parameter is required.', example='fd-u8B321****'),
  newFolderName?: string(name='NewFolderName', description='The new name of the folder.

The name must be 1 to 24 characters in length and can contain letters, digits, underscores (_), periods (.), and hyphens (-).

This parameter is required.', example='rdFolder'),
}

model UpdateFolderResponseBody = {
  folder?: {
    createTime?: string(name='CreateTime', description='The time when the folder was created.', example='2019-02-19T09:34:50.757Z'),
    folderId?: string(name='FolderId', description='The ID of the folder.', example='fd-u8B321****'),
    folderName?: string(name='FolderName', description='The name of the folder.', example='rdFolder'),
    parentFolderId?: string(name='ParentFolderId', description='The ID of the parent folder.', example='r-b1****'),
  }(name='Folder', description='The information about the folder.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C2CBCA30-C8DD-423E-B4AD-4FB694C9180C'),
}

model UpdateFolderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateFolderResponseBody(name='body'),
}

/**
 * @summary Changes the name of a folder.
 *
 * @param request UpdateFolderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateFolderResponse
 */
async function updateFolderWithOptions(request: UpdateFolderRequest, runtime: $RuntimeOptions): UpdateFolderResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.folderId)) {
    query['FolderId'] = request.folderId;
  }
  if (!$isNull(request.newFolderName)) {
    query['NewFolderName'] = request.newFolderName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateFolder',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Changes the name of a folder.
 *
 * @param request UpdateFolderRequest
 * @return UpdateFolderResponse
 */
async function updateFolder(request: UpdateFolderRequest): UpdateFolderResponse {
  var runtime = new $RuntimeOptions{};
  return updateFolderWithOptions(request, runtime);
}

model UpdateMessageContactRequest {
  contactId?: string(name='ContactId', description='The ID of the contact.', example='c-qL4HqKONzOM7****'),
  emailAddress?: string(name='EmailAddress', description='The email address of the contact.

After you specify an email address, you need to call [SendEmailVerificationForMessageContact](~~SendEmailVerificationForMessageContact~~) to send verification information to the email address. After the verification is passed, the email address takes effect.', example='someone***@example.com'),
  messageTypes?: [ string ](name='MessageTypes', description='The types of messages received by the contact.'),
  name?: string(name='Name', description='The name of the contact.', example='tom'),
  phoneNumber?: string(name='PhoneNumber', description='The mobile phone number of the contact.

Specify the mobile phone number in the `<Country code>-<Mobile phone number>` format.

After you specify a mobile phone number, you need to call [SendPhoneVerificationForMessageContact](~~SendPhoneVerificationForMessageContact~~) to send verification information to the mobile phone number. After the verification is passed, the mobile phone number takes effect.', example='86-139****1234'),
  title?: string(name='Title', description='The job title of the contact.

Valid values:

*   FinanceDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   TechnicalDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   MaintenanceDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   CEO

    <!-- -->

    <!-- -->

    <!-- -->

*   ProjectDirector

    <!-- -->

    <!-- -->

    <!-- -->

*   Other

    <!-- -->

    <!-- -->

    <!-- -->', example='TechnicalDirector'),
}

model UpdateMessageContactResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model UpdateMessageContactResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateMessageContactResponseBody(name='body'),
}

/**
 * @summary Updates a contact.
 *
 * @param request UpdateMessageContactRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateMessageContactResponse
 */
async function updateMessageContactWithOptions(request: UpdateMessageContactRequest, runtime: $RuntimeOptions): UpdateMessageContactResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.contactId)) {
    query['ContactId'] = request.contactId;
  }
  if (!$isNull(request.emailAddress)) {
    query['EmailAddress'] = request.emailAddress;
  }
  if (!$isNull(request.messageTypes)) {
    query['MessageTypes'] = request.messageTypes;
  }
  if (!$isNull(request.name)) {
    query['Name'] = request.name;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.title)) {
    query['Title'] = request.title;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateMessageContact',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates a contact.
 *
 * @param request UpdateMessageContactRequest
 * @return UpdateMessageContactResponse
 */
async function updateMessageContact(request: UpdateMessageContactRequest): UpdateMessageContactResponse {
  var runtime = new $RuntimeOptions{};
  return updateMessageContactWithOptions(request, runtime);
}

model UpdatePayerForAccountRequest {
  accountId?: string(name='AccountId', description='The Alibaba Cloud account ID of the member.

This parameter is required.', example='138660628348****'),
  payerAccountId?: string(name='PayerAccountId', description='The ID of the billing account.

This parameter is required.', example='12323344****'),
}

model UpdatePayerForAccountResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='9B34724D-54B0-4A51-B34D-4512372FE1BE'),
}

model UpdatePayerForAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdatePayerForAccountResponseBody(name='body'),
}

/**
 * @summary Updates the billing account of a member.
 *
 * @param request UpdatePayerForAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdatePayerForAccountResponse
 */
async function updatePayerForAccountWithOptions(request: UpdatePayerForAccountRequest, runtime: $RuntimeOptions): UpdatePayerForAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountId)) {
    query['AccountId'] = request.accountId;
  }
  if (!$isNull(request.payerAccountId)) {
    query['PayerAccountId'] = request.payerAccountId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdatePayerForAccount',
    version = '2022-04-19',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if ($isNull(@signatureVersion) || @signatureVersion != 'v4') {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Updates the billing account of a member.
 *
 * @param request UpdatePayerForAccountRequest
 * @return UpdatePayerForAccountResponse
 */
async function updatePayerForAccount(request: UpdatePayerForAccountRequest): UpdatePayerForAccountResponse {
  var runtime = new $RuntimeOptions{};
  return updatePayerForAccountWithOptions(request, runtime);
}

